@@ -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
@@ -128,16 +128,24 @@ require('lazy').setup({
128
128
129
129
-- don't override the built-in and fugitive keymaps
130
130
local gs = package.loaded .gitsigns
131
- vim .keymap .set ({' n' , ' v' }, ' ]c' , function ()
132
- if vim .wo .diff then return ' ]c' end
133
- vim .schedule (function () gs .next_hunk () end )
131
+ vim .keymap .set ({ ' n' , ' v' }, ' ]c' , function ()
132
+ if vim .wo .diff then
133
+ return ' ]c'
134
+ end
135
+ vim .schedule (function ()
136
+ gs .next_hunk ()
137
+ end )
134
138
return ' <Ignore>'
135
- end , {expr = true , buffer = bufnr , desc = " Jump to next hunk" })
136
- vim .keymap .set ({' n' , ' v' }, ' [c' , function ()
137
- if vim .wo .diff then return ' [c' end
138
- vim .schedule (function () gs .prev_hunk () end )
139
+ end , { expr = true , buffer = bufnr , desc = ' Jump to next hunk' })
140
+ vim .keymap .set ({ ' n' , ' v' }, ' [c' , function ()
141
+ if vim .wo .diff then
142
+ return ' [c'
143
+ end
144
+ vim .schedule (function ()
145
+ gs .prev_hunk ()
146
+ end )
139
147
return ' <Ignore>'
140
- end , {expr = true , buffer = bufnr , desc = " Jump to previous hunk" })
148
+ end , { expr = true , buffer = bufnr , desc = ' Jump to previous hunk' })
141
149
end ,
142
150
},
143
151
},
@@ -170,7 +178,7 @@ require('lazy').setup({
170
178
' lukas-reineke/indent-blankline.nvim' ,
171
179
-- Enable `lukas-reineke/indent-blankline.nvim`
172
180
-- See `:help indent_blankline.txt`
173
- main = " ibl" ,
181
+ main = ' ibl' ,
174
182
opts = {},
175
183
},
176
184
@@ -326,10 +334,10 @@ vim.defer_fn(function()
326
334
require (' nvim-treesitter.configs' ).setup {
327
335
-- Add languages to be installed here that you want installed for treesitter
328
336
ensure_installed = { ' c' , ' cpp' , ' go' , ' lua' , ' python' , ' rust' , ' tsx' , ' javascript' , ' typescript' , ' vimdoc' , ' vim' },
329
-
337
+
330
338
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
331
339
auto_install = false ,
332
-
340
+
333
341
highlight = { enable = true },
334
342
indent = { enable = true },
335
343
incremental_selection = {
@@ -440,15 +448,15 @@ local on_attach = function(_, bufnr)
440
448
end
441
449
442
450
-- document existing key chains
443
- require (' which-key' ).register ( {
451
+ require (' which-key' ).register {
444
452
[' <leader>c' ] = { name = ' [C]ode' , _ = ' which_key_ignore' },
445
453
[' <leader>d' ] = { name = ' [D]ocument' , _ = ' which_key_ignore' },
446
454
[' <leader>g' ] = { name = ' [G]it' , _ = ' which_key_ignore' },
447
455
[' <leader>h' ] = { name = ' More git' , _ = ' which_key_ignore' },
448
456
[' <leader>r' ] = { name = ' [R]ename' , _ = ' which_key_ignore' },
449
457
[' <leader>s' ] = { name = ' [S]earch' , _ = ' which_key_ignore' },
450
458
[' <leader>w' ] = { name = ' [W]orkspace' , _ = ' which_key_ignore' },
451
- })
459
+ }
452
460
453
461
-- Enable the following language servers
454
462
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -481,6 +489,11 @@ require('neodev').setup()
481
489
local capabilities = vim .lsp .protocol .make_client_capabilities ()
482
490
capabilities = require (' cmp_nvim_lsp' ).default_capabilities (capabilities )
483
491
492
+ -- mason-lspconfig requires that these setup functions are called in this order
493
+ -- before setting up the servers.
494
+ require (' mason' ).setup ()
495
+ require (' mason-lspconfig' ).setup ()
496
+
484
497
-- Ensure the servers above are installed
485
498
local mason_lspconfig = require ' mason-lspconfig'
486
499
@@ -496,7 +509,7 @@ mason_lspconfig.setup_handlers {
496
509
settings = servers [server_name ],
497
510
filetypes = (servers [server_name ] or {}).filetypes ,
498
511
}
499
- end
512
+ end ,
500
513
}
501
514
502
515
-- [[ Configure nvim-cmp ]]
0 commit comments