feat(nvim): simplify lsp config
This commit is contained in:
parent
44adf70862
commit
92b9ac1233
5 changed files with 22 additions and 132 deletions
|
|
@ -132,13 +132,6 @@ with builtins;
|
|||
{ plugin = which-key-nvim; }
|
||||
{ plugin = lspkind-nvim; }
|
||||
{ plugin = lsp_lines-nvim; }
|
||||
{
|
||||
plugin = lspsaga-nvim-original;
|
||||
dependencies = [
|
||||
{ plugin = nvim-web-devicons; }
|
||||
{ plugin = nvim-treesitter.withAllGrammars; }
|
||||
];
|
||||
}
|
||||
{
|
||||
plugin = nvim-ufo;
|
||||
dependencies = [
|
||||
|
|
|
|||
|
|
@ -53,51 +53,50 @@ capabilities.textDocument.foldingRange = {
|
|||
}
|
||||
require("ufo").setup()
|
||||
|
||||
require("lspsaga").setup({
|
||||
symbol_in_winbar = {
|
||||
enable = false,
|
||||
},
|
||||
lightbulb = {
|
||||
enable = false,
|
||||
enable_in_insert = false,
|
||||
},
|
||||
})
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local on_attach_def = function(_, bufnr)
|
||||
require("which-key").register({
|
||||
K = { "<cmd>Lspsaga hover_doc ++quiet<cr>", "show info" },
|
||||
K = { vim.lsp.buf.hover, "Hover" },
|
||||
["<leader>"] = {
|
||||
l = {
|
||||
d = { "<cmd>Lspsaga show_cursor_diagnostics<cr>", "open diagnostic window" },
|
||||
c = { "<cmd>Lspsaga code_action<cr>", "code action" },
|
||||
r = { "<cmd>Lspsaga rename<cr>", "rename" },
|
||||
i = { "<cmd>Lspsaga hover_doc ++keep<cr>", "show info (sticky)" },
|
||||
d = { vim.diagnostic.open_float, "Open diagnostic window" },
|
||||
c = { vim.lsp.buf.code_action, "Code action" },
|
||||
r = { vim.lsp.buf.rename, "Rename" },
|
||||
f = {
|
||||
function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end,
|
||||
"format (lsp)",
|
||||
"Format (lsp)",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
},
|
||||
t = {
|
||||
l = { lsp_lines.toggle, "lsp lines" },
|
||||
l = { lsp_lines.toggle, "Lsp lines" },
|
||||
},
|
||||
},
|
||||
g = {
|
||||
d = { "<cmd>Lspsaga peek_definition<cr>", "Goto definition" },
|
||||
t = { "<cmd>Lspsaga peek_type_definition<cr>", "Goto type defininition" },
|
||||
h = { "<cmd>Lspsaga lsp_finder<CR>", "Lsp finder" },
|
||||
r = { "<cmd>Telescope lsp_references<cr>", "Goto reference" },
|
||||
d = {
|
||||
function()
|
||||
require("telescope.builtin").lsp_definitions({ reuse_win = true })
|
||||
end,
|
||||
"Goto definition",
|
||||
},
|
||||
t = {
|
||||
function()
|
||||
require("telescope.builtin").lsp_type_definitions({ reuse_win = true })
|
||||
end,
|
||||
"Goto type defininition",
|
||||
},
|
||||
r = { "<cmd>Telescope lsp_references<cr>", "Goto references" },
|
||||
D = { vim.lsp.buf.declaration, "Goto declaration" },
|
||||
I = { "<cmd>Telescope lsp_implementations<cr>", "Goto implementation" },
|
||||
K = { vim.lsp.buf.signature_help, "Signature help" },
|
||||
},
|
||||
["["] = {
|
||||
d = { "<cmd>Lspsaga diagnostic_jump_prev<cr>", "Previous diagnostic" },
|
||||
d = { vim.diagnostic.goto_prev, "Previous diagnostic" },
|
||||
},
|
||||
["]"] = {
|
||||
d = { "<cmd>Lspsaga diagnostic_jump_next<cr>", "Next diagnostic" },
|
||||
d = { vim.diagnostic.goto_next, "Next diagnostic" },
|
||||
},
|
||||
}, { buffer = bufnr, silent = true })
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue