about summary refs log tree commit diff
path: root/fnl
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-10-01 22:20:04 +0900
committersefidel <contact@sefidel.net>2023-10-01 23:13:12 +0900
commitff2b7e744afec051844aa20e25b9564a44505ffb (patch)
tree777e507fb2531b40da22a3c7f378e2f4555c024b /fnl
parent9805575ca35b2c1519e363309a9965bc56bb26a0 (diff)
downloadnvimrc-ff2b7e744afec051844aa20e25b9564a44505ffb.tar.gz
nvimrc-ff2b7e744afec051844aa20e25b9564a44505ffb.zip
feat(pack): aggressively lazy load packs
Diffstat (limited to 'fnl')
-rw-r--r--fnl/nvrc/pack.fnl29
-rw-r--r--fnl/nvrc/packs/lspconfig.fnl6
2 files changed, 19 insertions, 16 deletions
diff --git a/fnl/nvrc/pack.fnl b/fnl/nvrc/pack.fnl
index 15481b3..5708f51 100644
--- a/fnl/nvrc/pack.fnl
+++ b/fnl/nvrc/pack.fnl
@@ -5,8 +5,9 @@
 (pack! :rktjmp/hotpot.nvim)
 
 (pack! :nanotech/jellybeans.vim {:config #((. (require :nvrc.colors) :apply) :jellybeans)})
-(pack! :kvrohit/rasmus.nvim)
+(pack! :kvrohit/rasmus.nvim {:lazy true})
 (pack! :nvim-treesitter/nvim-treesitter {:req :treesitter
+                                         :event [:BufReadPost :BufNewFile]
                                          :dependencies [(pack :nvim-treesitter/nvim-treesitter-refactor)
                                                         (pack :nvim-treesitter/nvim-treesitter-textobjects)]})
 
@@ -14,25 +15,33 @@
 (pack! :justinmk/vim-dirvish)
 
 (pack! :neovim/nvim-lspconfig {:req :lspconfig
+                               :event :BufReadPre
                                :dependencies [(pack :j-hui/fidget.nvim {:req :fidget :branch :legacy})]})
-(pack! :simrat39/rust-tools.nvim {:req :rust :ft :rust :dependencies [(pack :nvim-lua/plenary.nvim)]})
-(pack! :p00f/clangd_extensions.nvim {:req :clangd :ft [:c :cpp :objc :objcpp]})
-(pack! :mfussenegger/nvim-dap {:req :dap :dependencies [(pack :nvim-lua/plenary.nvim)
-                                                        (pack :rcarriga/nvim-dap-ui {:init :dapui})]})
+(pack! :simrat39/rust-tools.nvim {:req :rust
+                                  :event :BufReadPre ;; doesn't work when loaded on filetype
+                                  :dependencies [(pack :nvim-lua/plenary.nvim)]})
+(pack! :p00f/clangd_extensions.nvim {:req :clangd
+                                     :ft [:c :cpp :objc :objcpp]})
+(pack! :mfussenegger/nvim-dap {:req :dap
+                               :event :VeryLazy
+                               :dependencies [(pack :nvim-lua/plenary.nvim)
+                                              (pack :rcarriga/nvim-dap-ui {:init :dapui :lazy true})]}
+                               :lazy true)
 (pack! :gpanders/editorconfig.nvim)
 (pack! :stefandtw/quickfix-reflector.vim {:ft :qf})
 (pack! :tpope/vim-fugitive)
 (pack! :tpope/vim-eunuch)
 (pack! :tpope/vim-sleuth)
 
-(pack! :hrsh7th/nvim-cmp {:req :cmp :event :BufEnter
+(pack! :hrsh7th/nvim-cmp {:req :cmp
+                          :event [:InsertEnter :CmdlineEnter]
                           :dependencies [(pack :L3MON4D3/LuaSnip)
                                          (pack :lukas-reineke/cmp-under-comparator)
                                          (pack :hrsh7th/cmp-nvim-lsp {:after :nvim-cmp})
                                          (pack :hrsh7th/cmp-nvim-lsp-signature-help)]})
-(pack! :numToStr/Comment.nvim {:init :Comment})
-(pack! :ibhagwan/fzf-lua {:req :fzf})
-(pack! :ggandor/leap.nvim {:req :leap})
-(pack! :windwp/nvim-autopairs {:req :autopairs})
+(pack! :numToStr/Comment.nvim {:init :Comment :lazy true})
+(pack! :ibhagwan/fzf-lua {:req :fzf :lazy true})
+(pack! :ggandor/leap.nvim {:req :leap :lazy true})
+(pack! :windwp/nvim-autopairs {:req :autopairs :lazy true})
 
 (unpack!)
diff --git a/fnl/nvrc/packs/lspconfig.fnl b/fnl/nvrc/packs/lspconfig.fnl
index e69c337..55d0bd0 100644
--- a/fnl/nvrc/packs/lspconfig.fnl
+++ b/fnl/nvrc/packs/lspconfig.fnl
@@ -10,12 +10,6 @@
         autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
         augroup END" false))))
 
-(fn better_root_pattern [patterns except-patterns]
-  "match path if one of the given patterns is matched, EXCEPT if one of the except-patterns is matched"
-  (fn [path]
-    (when (not ((lsp.util.root_pattern except-patterns) path))
-      ((lsp.util.root_pattern patterns) path))))
-
 (local default_capabilities (vim.lsp.protocol.make_client_capabilities))
 
 (fn init_lsp [lsp-name ?opts]