From 16c8ca5333c08081ee2e3c197cb42dc7761dcefd Mon Sep 17 00:00:00 2001 From: Simon Lasbrugnas Date: Tue, 6 Jan 2026 13:02:37 +0100 Subject: [PATCH] chore: update lsp config --- lua/custom/lsp/config.lua | 75 ++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/lua/custom/lsp/config.lua b/lua/custom/lsp/config.lua index 544a5c2..8744761 100644 --- a/lua/custom/lsp/config.lua +++ b/lua/custom/lsp/config.lua @@ -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", "ca", function() vim.lsp.buf.code_action() 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", "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", "rn", function() + vim.lsp.buf.rename() + end, opts) end)