@@ -81,7 +81,7 @@ require('lazy').setup({
81
81
' neovim/nvim-lspconfig' ,
82
82
dependencies = {
83
83
-- Automatically install LSPs to stdpath for neovim
84
- { ' williamboman/mason.nvim' , config = true } ,
84
+ ' williamboman/mason.nvim' ,
85
85
' williamboman/mason-lspconfig.nvim' ,
86
86
87
87
-- Useful status updates for LSP
@@ -178,7 +178,7 @@ require('lazy').setup({
178
178
' lukas-reineke/indent-blankline.nvim' ,
179
179
-- Enable `lukas-reineke/indent-blankline.nvim`
180
180
-- See `:help indent_blankline.txt`
181
- main = " ibl" ,
181
+ main = ' ibl' ,
182
182
opts = {},
183
183
},
184
184
@@ -331,26 +331,18 @@ vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc =
331
331
332
332
-- [[ Configure Treesitter ]]
333
333
-- See `:help nvim-treesitter`
334
- require (' nvim-treesitter.configs' ).setup {
335
- -- Add languages to be installed here that you want installed for treesitter
336
- ensure_installed = { ' c' , ' cpp' , ' go' , ' lua' , ' java' , ' json' , ' yaml' , ' python' , ' rust' , ' tsx' , ' javascript' , ' typescript' , ' vimdoc' , ' vim' },
337
-
338
- -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
339
- auto_install = false ,
340
-
341
- highlight = { enable = true },
342
- indent = { enable = true },
343
- incremental_selection = {
344
- enable = true ,
345
- keymaps = {
346
- init_selection = ' <c-space>' ,
347
- node_incremental = ' <c-space>' ,
348
- scope_incremental = ' <c-s>' ,
349
- node_decremental = ' <M-space>' ,
350
- },
351
- },
352
- textobjects = {
353
- select = {
334
+ -- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
335
+ vim .defer_fn (function ()
336
+ require (' nvim-treesitter.configs' ).setup {
337
+ -- Add languages to be installed here that you want installed for treesitter
338
+ ensure_installed = { ' c' , ' cpp' , ' go' , ' lua' , ' python' , ' rust' , ' tsx' , ' javascript' , ' typescript' , ' vimdoc' , ' vim' },
339
+
340
+ -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
341
+ auto_install = false ,
342
+
343
+ highlight = { enable = true },
344
+ indent = { enable = true },
345
+ incremental_selection = {
354
346
enable = true ,
355
347
keymaps = {
356
348
init_selection = ' <c-space>' ,
@@ -459,15 +451,20 @@ local on_attach = function(_, bufnr)
459
451
end
460
452
461
453
-- document existing key chains
462
- require (' which-key' ).register ( {
454
+ require (' which-key' ).register {
463
455
[' <leader>c' ] = { name = ' [C]ode' , _ = ' which_key_ignore' },
464
456
[' <leader>d' ] = { name = ' [D]ocument' , _ = ' which_key_ignore' },
465
457
[' <leader>g' ] = { name = ' [G]it' , _ = ' which_key_ignore' },
466
458
[' <leader>h' ] = { name = ' More git' , _ = ' which_key_ignore' },
467
459
[' <leader>r' ] = { name = ' [R]ename' , _ = ' which_key_ignore' },
468
460
[' <leader>s' ] = { name = ' [S]earch' , _ = ' which_key_ignore' },
469
461
[' <leader>w' ] = { name = ' [W]orkspace' , _ = ' which_key_ignore' },
470
- })
462
+ }
463
+
464
+ -- mason-lspconfig requires that these setup functions are called in this order
465
+ -- before setting up the servers.
466
+ require (' mason' ).setup ()
467
+ require (' mason-lspconfig' ).setup ()
471
468
472
469
-- Enable the following language servers
473
470
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
0 commit comments