Something went wrong. Try again.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152(import-macros {: user-cmd! : autocmd!} :macros)
;; Disable default plugins(let [disabled-plugins [:zipPlugin :zip :tarPlugin :tar :gzip :tohtml :man :rplugin :tutor_mode_plugin]] (each [_ k (ipairs disabled-plugins)] (set (. vim.g (.. :loaded_ k)) 1)))
(user-cmd! :PackUpdate (fn [args] (if (> (length args.fargs) 0) (vim.pack.update args.fargs) (vim.pack.update))) {:nargs "*" :complete :packadd})
(user-cmd! :PackDel (fn [args] (vim.pack.del args.fargs {:force true})) {:nargs "+" :complete :packadd})
;; Clean up compiled sprig files when a plugin is deleted(autocmd! :PackChanged {:callback (fn [ev] (when (= ev.data.kind :delete) (let [cache-dir (.. (vim.fn.stdpath :cache) :/sprig) name ev.data.spec.name compiled (.. cache-dir :/plugin/pack/ name :.lua)] (when (= (vim.fn.filereadable compiled) 1) (os.remove compiled) (vim.notify (.. "sprig: removed compiled file for " name))))))})
;; Lazy load builtin undotree plugin(user-cmd! :Undotree (fn [] (vim.api.nvim_del_user_command :Undotree) (vim.cmd.packadd :nvim.undotree) (vim.cmd :Undotree)) {})
;; Lazy load difftool plugin(user-cmd! :DiffTool (fn [args] (vim.api.nvim_del_user_command :DiffTool) (vim.cmd.packadd :nvim.difftool) (vim.cmd (.. "DiffTool " args.args))) {:nargs "*" :complete :file})