Skip to content

Commit 6ffc5a1

Browse files
Fix Mason setup issue and run stylua.
1 parent f15af9b commit 6ffc5a1

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

init.lua

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ require('lazy').setup({
8181
'neovim/nvim-lspconfig',
8282
dependencies = {
8383
-- Automatically install LSPs to stdpath for neovim
84-
{ 'williamboman/mason.nvim', config = true },
84+
'williamboman/mason.nvim',
8585
'williamboman/mason-lspconfig.nvim',
8686

8787
-- Useful status updates for LSP
@@ -128,16 +128,24 @@ require('lazy').setup({
128128

129129
-- don't override the built-in and fugitive keymaps
130130
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)
134138
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)
139147
return '<Ignore>'
140-
end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"})
148+
end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' })
141149
end,
142150
},
143151
},
@@ -170,7 +178,7 @@ require('lazy').setup({
170178
'lukas-reineke/indent-blankline.nvim',
171179
-- Enable `lukas-reineke/indent-blankline.nvim`
172180
-- See `:help indent_blankline.txt`
173-
main = "ibl",
181+
main = 'ibl',
174182
opts = {},
175183
},
176184

@@ -326,10 +334,10 @@ vim.defer_fn(function()
326334
require('nvim-treesitter.configs').setup {
327335
-- Add languages to be installed here that you want installed for treesitter
328336
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
329-
337+
330338
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
331339
auto_install = false,
332-
340+
333341
highlight = { enable = true },
334342
indent = { enable = true },
335343
incremental_selection = {
@@ -440,15 +448,15 @@ local on_attach = function(_, bufnr)
440448
end
441449

442450
-- document existing key chains
443-
require('which-key').register({
451+
require('which-key').register {
444452
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
445453
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
446454
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
447455
['<leader>h'] = { name = 'More git', _ = 'which_key_ignore' },
448456
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
449457
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
450458
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
451-
})
459+
}
452460

453461
-- Enable the following language servers
454462
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -481,6 +489,11 @@ require('neodev').setup()
481489
local capabilities = vim.lsp.protocol.make_client_capabilities()
482490
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
483491

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+
484497
-- Ensure the servers above are installed
485498
local mason_lspconfig = require 'mason-lspconfig'
486499

@@ -496,7 +509,7 @@ mason_lspconfig.setup_handlers {
496509
settings = servers[server_name],
497510
filetypes = (servers[server_name] or {}).filetypes,
498511
}
499-
end
512+
end,
500513
}
501514

502515
-- [[ Configure nvim-cmp ]]

0 commit comments

Comments
 (0)