From 8519e22d00122fb374838750007679a7844fa492 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 8 Aug 2023 04:18:14 +0200 Subject: [PATCH] vim/diagnostics: add central coniguration --- config/nvim/lua/fschauen/diagnostics.lua | 23 +++++++++++++++++++++++ config/nvim/lua/fschauen/init.lua | 1 + config/nvim/lua/fschauen/util.lua | 8 ++++---- 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 config/nvim/lua/fschauen/diagnostics.lua diff --git a/config/nvim/lua/fschauen/diagnostics.lua b/config/nvim/lua/fschauen/diagnostics.lua new file mode 100644 index 0000000..7f90313 --- /dev/null +++ b/config/nvim/lua/fschauen/diagnostics.lua @@ -0,0 +1,23 @@ +vim.diagnostic.config { + underline = false, + virtual_text = { + spacing = 6, + prefix = '●', + }, + float = { + border = 'rounded', + }, + severity_sort = true, +} + +local signs = { + Error = ' ', + Warn = ' ', + Info = ' ', + Hint = ' ', +} + +for type, icon in pairs(signs) do + local hl = 'DiagnosticSign' .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) +end diff --git a/config/nvim/lua/fschauen/init.lua b/config/nvim/lua/fschauen/init.lua index bdec65a..cf62d03 100644 --- a/config/nvim/lua/fschauen/init.lua +++ b/config/nvim/lua/fschauen/init.lua @@ -7,5 +7,6 @@ require 'fschauen.options' require 'fschauen.keymap' require 'fschauen.autocmds' require 'fschauen.filetypes' +require 'fschauen.diagnostics' require 'fschauen.lazy' diff --git a/config/nvim/lua/fschauen/util.lua b/config/nvim/lua/fschauen/util.lua index 93b2e48..86c8e4c 100644 --- a/config/nvim/lua/fschauen/util.lua +++ b/config/nvim/lua/fschauen/util.lua @@ -79,9 +79,9 @@ end local diag_opts = { wrap = false, -- don't wrap around the begin/end of file - float = { - border = 'rounded' -- enable border for the floating window - }, + -- float = { + -- border = 'rounded' -- enable border for the floating window + -- }, } --- Move to the next diagnostic. @@ -99,7 +99,7 @@ M.goto_prev_diagnostic = function(opts) end M.open_float_diagnostic = function(opts) - vim.diagnostic.open_float(vim.tbl_extend('keep', opts or {}, { border = 'rounded' })) + vim.diagnostic.open_float(opts) end M.toggle_diagnostics = function(bufnr)