From 544493be54bc3bf531cea1b20e9fe36aba5a5d90 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 17 Oct 2025 12:48:18 +0300 Subject: nvim: update lsp config --- .config/nvim/lua/plugins/lsp.lua | 49 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to '.config') diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index cb3dcca..8bc496c 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -12,35 +12,36 @@ return { local map = require("helpers.keys").map map('n', 'e', vim.diagnostic.open_float, "lsp: open diagnostics float") - map('n', '[d', vim.diagnostic.goto_prev, "lsp: goto previous diagnostic") - map('n', ']d', vim.diagnostic.goto_next, "lsp: goto next diagnostic") + map('n', '[d', function() vim.diagnostic.jump({ count = -1, float = true }) end, + "lsp: goto previous diagnostic") + map('n', ']d', function() vim.diagnostic.jump({ count = 1, float = true }) end, "lsp: goto next diagnostic") - -- set up cool signs for diagnostics - local signs = { Error = " ", Warn = "", Hint = "", Info = "" } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) - end - - -- Diagnostic config - local config = { - virtual_text = false, + vim.diagnostic.config({ + underline = true, signs = { - active = signs, + active = true, + text = { + [vim.diagnostic.severity.ERROR] = "", + [vim.diagnostic.severity.WARN] = "", + [vim.diagnostic.severity.HINT] = "󰟃", + [vim.diagnostic.severity.INFO] = "", + }, }, - update_in_insert = true, - underline = true, - severity_sort = true, + virtual_text = false, float = { - focusable = true, - style = "minimal", - border = "rounded", - source = "always", header = "", - prefix = "", + border = "rounded", + format = function(diagnostic) + return string.format( + "%s (%s) [%s]", + diagnostic.message, + diagnostic.source, + diagnostic.code or diagnostic.user_data.lsp.code + ) + end, }, - } - vim.diagnostic.config(config) + + }) -- this function gets run when an lsp connects to a particular buffer. local on_attach = function(_, bufnr) @@ -195,7 +196,7 @@ return { require("ltex_extra").setup { load_langs = { "en-GB" }, init_check = true, - log_level = "none", + log_level = "warn", } end, filetypes = { "bib", "gitcommit", "markdown", "org", "plaintex", "rst", "rnoweb", "tex", "pandoc", "quarto", "rmd", "context", "mail", "text" }, -- cgit v1.2.3-70-g09d2