chore: update lsp config
This commit is contained in:
parent
b4fac7a4b7
commit
16c8ca5333
1 changed files with 47 additions and 28 deletions
|
|
@ -1,24 +1,28 @@
|
||||||
local lsp_zero = require("lsp-zero")
|
local lsp_zero = require("lsp-zero")
|
||||||
|
|
||||||
-- Configure Vim diagnostic
|
-- Configure Vim diagnostic
|
||||||
-- vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
-- virtual_text = true,
|
virtual_text = true,
|
||||||
-- severity_sort = true,
|
virtual_lines = false,
|
||||||
-- float = {
|
severity_sort = true,
|
||||||
-- style = "minimal",
|
float = {
|
||||||
-- border = "none",
|
style = "minimal",
|
||||||
-- source = "if_many",
|
border = "none",
|
||||||
-- header = "",
|
source = "if_many",
|
||||||
-- prefix = "",
|
header = "",
|
||||||
-- },
|
prefix = "",
|
||||||
-- })
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- Lsp icons
|
-- Lsp icons
|
||||||
lsp_zero.set_sign_icons({
|
lsp_zero.ui({
|
||||||
|
float_border = "none",
|
||||||
|
sign_text = {
|
||||||
error = "✘",
|
error = "✘",
|
||||||
warn = "▲",
|
warn = "▲",
|
||||||
hint = "⚑",
|
hint = "⚑",
|
||||||
info = ""
|
info = "",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Keybindings
|
-- Keybindings
|
||||||
|
|
@ -28,16 +32,31 @@ lsp_zero.on_attach(function(_, bufnr)
|
||||||
-- Disable inlay hints (virtual text for variable types and name of function parameters)
|
-- Disable inlay hints (virtual text for variable types and name of function parameters)
|
||||||
vim.lsp.inlay_hint.enable(false)
|
vim.lsp.inlay_hint.enable(false)
|
||||||
|
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
vim.keymap.set("n", "gd", function()
|
||||||
vim.keymap.set("n", "gi", function() vim.lsp.buf.implementation() end, opts)
|
vim.lsp.buf.definition()
|
||||||
vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts)
|
end, opts)
|
||||||
vim.keymap.set("n", "gt", function() vim.lsp.buf.type_definition() end, opts)
|
vim.keymap.set("n", "gi", function()
|
||||||
vim.keymap.set("n", "g.", function() vim.lsp.buf.code_action() end, opts)
|
vim.lsp.buf.implementation()
|
||||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
end, opts)
|
||||||
vim.keymap.set("n", "[d", function() vim.diagnostic.jump({ count = 1 }) end, opts)
|
vim.keymap.set("n", "gr", function()
|
||||||
vim.keymap.set("n", "]d", function() vim.diagnostic.jump({ count = -1 }) end, opts)
|
vim.lsp.buf.references()
|
||||||
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
|
end, opts)
|
||||||
vim.keymap.set("n", "<leader>gi", function() vim.lsp.buf.implementation() end, opts)
|
vim.keymap.set("n", "gt", function()
|
||||||
vim.keymap.set("n", "<leader>gr", function() vim.lsp.buf.references() end, opts)
|
vim.lsp.buf.type_definition()
|
||||||
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
|
end, opts)
|
||||||
|
vim.keymap.set("n", "g.", function()
|
||||||
|
vim.lsp.buf.code_action()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "K", function()
|
||||||
|
vim.lsp.buf.hover()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "[d", function()
|
||||||
|
vim.diagnostic.jump({ count = 1 })
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "]d", function()
|
||||||
|
vim.diagnostic.jump({ count = -1 })
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>rn", function()
|
||||||
|
vim.lsp.buf.rename()
|
||||||
|
end, opts)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue