Fix Mason setup issue and run stylua.
This commit is contained in:
parent
f15af9b8be
commit
6ffc5a169f
1 changed files with 28 additions and 15 deletions
43
init.lua
43
init.lua
|
@ -81,7 +81,7 @@ require('lazy').setup({
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Automatically install LSPs to stdpath for neovim
|
-- Automatically install LSPs to stdpath for neovim
|
||||||
{ 'williamboman/mason.nvim', config = true },
|
'williamboman/mason.nvim',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
-- Useful status updates for LSP
|
-- Useful status updates for LSP
|
||||||
|
@ -128,16 +128,24 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- don't override the built-in and fugitive keymaps
|
-- don't override the built-in and fugitive keymaps
|
||||||
local gs = package.loaded.gitsigns
|
local gs = package.loaded.gitsigns
|
||||||
vim.keymap.set({'n', 'v'}, ']c', function()
|
vim.keymap.set({ 'n', 'v' }, ']c', function()
|
||||||
if vim.wo.diff then return ']c' end
|
if vim.wo.diff then
|
||||||
vim.schedule(function() gs.next_hunk() end)
|
return ']c'
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
gs.next_hunk()
|
||||||
|
end)
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"})
|
end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' })
|
||||||
vim.keymap.set({'n', 'v'}, '[c', function()
|
vim.keymap.set({ 'n', 'v' }, '[c', function()
|
||||||
if vim.wo.diff then return '[c' end
|
if vim.wo.diff then
|
||||||
vim.schedule(function() gs.prev_hunk() end)
|
return '[c'
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
gs.prev_hunk()
|
||||||
|
end)
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"})
|
end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -170,7 +178,7 @@ require('lazy').setup({
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
-- See `:help indent_blankline.txt`
|
-- See `:help indent_blankline.txt`
|
||||||
main = "ibl",
|
main = 'ibl',
|
||||||
opts = {},
|
opts = {},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -326,10 +334,10 @@ vim.defer_fn(function()
|
||||||
require('nvim-treesitter.configs').setup {
|
require('nvim-treesitter.configs').setup {
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
auto_install = false,
|
auto_install = false,
|
||||||
|
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
|
@ -440,7 +448,7 @@ local on_attach = function(_, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- document existing key chains
|
-- document existing key chains
|
||||||
require('which-key').register({
|
require('which-key').register {
|
||||||
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
||||||
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
||||||
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
||||||
|
@ -448,7 +456,7 @@ require('which-key').register({
|
||||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||||
})
|
}
|
||||||
|
|
||||||
-- Enable the following language servers
|
-- Enable the following language servers
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||||
|
@ -481,6 +489,11 @@ require('neodev').setup()
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||||
|
|
||||||
|
-- mason-lspconfig requires that these setup functions are called in this order
|
||||||
|
-- before setting up the servers.
|
||||||
|
require('mason').setup()
|
||||||
|
require('mason-lspconfig').setup()
|
||||||
|
|
||||||
-- Ensure the servers above are installed
|
-- Ensure the servers above are installed
|
||||||
local mason_lspconfig = require 'mason-lspconfig'
|
local mason_lspconfig = require 'mason-lspconfig'
|
||||||
|
|
||||||
|
@ -496,7 +509,7 @@ mason_lspconfig.setup_handlers {
|
||||||
settings = servers[server_name],
|
settings = servers[server_name],
|
||||||
filetypes = (servers[server_name] or {}).filetypes,
|
filetypes = (servers[server_name] or {}).filetypes,
|
||||||
}
|
}
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- [[ Configure nvim-cmp ]]
|
-- [[ Configure nvim-cmp ]]
|
||||||
|
|
Loading…
Reference in a new issue