diff --git a/vim/.vim/lua/plugins/diagnostics.lua b/vim/.vim/lua/plugins/diagnostics.lua index b7fda08..36222a9 100644 --- a/vim/.vim/lua/plugins/diagnostics.lua +++ b/vim/.vim/lua/plugins/diagnostics.lua @@ -1,47 +1,49 @@ return { - "Maan2003/lsp_lines.nvim", - event = "VimEnter", - name = "lsp_lines.nvim", - config = function() - local signs = { - Error = " ", - Warning = " ", - Hint = " ", - Info = " ", - Other = " ", - } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) - end + { + "Maan2003/lsp_lines.nvim", + event = { "LspAttach" }, + name = "lsp_lines.nvim", + config = function() + local signs = { + Error = " ", + Warning = " ", + Hint = " ", + Info = " ", + Other = " ", + } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + end - require("lsp_lines").setup() + require("lsp_lines").setup() - vim.schedule(function() - vim.diagnostic.config({ - virtual_text = false, - virtual_improved = { - current_line = "hide", - }, - virtual_lines = { highlight_whole_line = false, only_current_line = true }, - }) - end) - end, - keys = { - { - "l", - function() - local new_value = not vim.diagnostic.config().virtual_lines.only_current_line + vim.schedule(function() vim.diagnostic.config({ - virtual_text = not new_value, + severity_sort = true, + virtual_text = false, virtual_improved = { - current_line = new_value and "hide" or "show", + current_line = "hide", }, - virtual_lines = { only_current_line = new_value }, + virtual_lines = { highlight_whole_line = false, only_current_line = true }, }) - return new_value - end, - desc = "Toggle LSP Lines", + end) + end, + keys = { + { + "l", + function() + local new_value = not vim.diagnostic.config().virtual_lines.only_current_line + vim.diagnostic.config({ + virtual_improved = { + current_line = new_value and "default" or "hide", + }, + virtual_lines = { only_current_line = new_value }, + }) + return new_value + end, + desc = "Toggle LSP Lines", + }, }, }, { @@ -51,15 +53,9 @@ return { require("lsp-virtual-improved").setup() end, }, - { - "dgagn/diagflow.nvim", - opts = { - toggle_event = { "InsertEnter" }, - }, - }, { "folke/trouble.nvim", - event = "VimEnter", + event = { "LspAttach" }, config = function() -- Diagnostics require("trouble").setup({