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")
|
||||
|
||||
-- Configure Vim diagnostic
|
||||
-- vim.diagnostic.config({
|
||||
-- virtual_text = true,
|
||||
-- severity_sort = true,
|
||||
-- float = {
|
||||
-- style = "minimal",
|
||||
-- border = "none",
|
||||
-- source = "if_many",
|
||||
-- header = "",
|
||||
-- prefix = "",
|
||||
-- },
|
||||
-- })
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
virtual_lines = false,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
style = "minimal",
|
||||
border = "none",
|
||||
source = "if_many",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
|
||||
-- Lsp icons
|
||||
lsp_zero.set_sign_icons({
|
||||
error = "✘",
|
||||
warn = "▲",
|
||||
hint = "⚑",
|
||||
info = ""
|
||||
lsp_zero.ui({
|
||||
float_border = "none",
|
||||
sign_text = {
|
||||
error = "✘",
|
||||
warn = "▲",
|
||||
hint = "⚑",
|
||||
info = "",
|
||||
},
|
||||
})
|
||||
|
||||
-- Keybindings
|
||||
|
|
@ -28,16 +32,31 @@ lsp_zero.on_attach(function(_, bufnr)
|
|||
-- Disable inlay hints (virtual text for variable types and name of function parameters)
|
||||
vim.lsp.inlay_hint.enable(false)
|
||||
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "gi", function() vim.lsp.buf.implementation() end, opts)
|
||||
vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set("n", "gt", function() vim.lsp.buf.type_definition() 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>ca", function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set("n", "<leader>gi", function() vim.lsp.buf.implementation() end, opts)
|
||||
vim.keymap.set("n", "<leader>gr", function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set("n", "gd", function()
|
||||
vim.lsp.buf.definition()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "gi", function()
|
||||
vim.lsp.buf.implementation()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "gr", function()
|
||||
vim.lsp.buf.references()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "gt", function()
|
||||
vim.lsp.buf.type_definition()
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue