diff options
Diffstat (limited to '.vim/plugin/diagnostics.lua')
| -rw-r--r-- | .vim/plugin/diagnostics.lua | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/.vim/plugin/diagnostics.lua b/.vim/plugin/diagnostics.lua index 70deec3..93ee621 100644 --- a/.vim/plugin/diagnostics.lua +++ b/.vim/plugin/diagnostics.lua @@ -7,7 +7,7 @@ vim.diagnostic.config({ [vim.diagnostic.severity.HINT] = '🞶', }, linehl = { - [vim.diagnostic.severity.ERROR] = 'Search', + -- [vim.diagnostic.severity.ERROR] = 'Search', -- [vim.diagnostic.severity.WARN] = '', -- [vim.diagnostic.severity.INFO] = '', -- [vim.diagnostic.severity.HINT] = '', @@ -19,16 +19,13 @@ vim.diagnostic.config({ [vim.diagnostic.severity.HINT] = 'DiagnosticSignHint', }, }, + severity_sort = true, underline = { - severity = { min = vim.diagnostic.severity.HINT }, - }, - float = { - severity = { min = vim.diagnostic.severity.HINT }, - }, - virtual_text = { - severity = { min = vim.diagnostic.severity.HINT }, + severity = { min = vim.diagnostic.severity.WARN }, }, - severity_sort = true, + float = false, + virtual_text = false, + virtual_lines = false, }) local commonhl = { undercurl = true, force = true } @@ -38,22 +35,29 @@ vim.api.nvim_set_hl(0, 'DiagnosticUnderlineInfo', commonhl) vim.api.nvim_set_hl(0, 'DiagnosticUnderlineHint', commonhl) vim.keymap.set('n', '[d', function() - vim.diagnostic.goto_next() + vim.diagnostic.jump({ count = 1, float = true }) end, { desc = 'diagnostic: next' }) + vim.keymap.set('n', ']d', function() - vim.diagnostic.goto_prev() + vim.diagnostic.jump({ count = -1, float = true }) end, { desc = 'diagnostic: prev' }) + vim.keymap.set('n', 'DD', vim.diagnostic.open_float, { desc = 'diagnostic: current line' }) + vim.keymap.set('n', '<leader>td', function() - if not _G.diagnostic_hidden then + -- NOTE: this can be used to switch between multiple sets of diagnostics display + -- currently it only toggles virtual_text + local visible = vim.diagnostic.config().virtual_text + + if visible then -- vim.diagnostic.hide(nil, 0) vim.diagnostic.config({ virtual_text = false }) else -- vim.diagnostic.show(nil, 0) vim.diagnostic.config({ virtual_text = true }) end - _G.diagnostic_hidden = not _G.diagnostic_hidden -end, { desc = 'diagnostic: toggle' }) +end, { desc = 'diagnostic: toggle visibility' }) + vim.keymap.set('n', '<leader>tD', function() vim.diagnostic.enable(not vim.diagnostic.is_enabled()) -end, { desc = 'diagnostic: toggle' }) +end, { desc = 'diagnostic: toggle all' }) |