From 031020cb9ddf3bba9333fe06806ba522bbea3055 Mon Sep 17 00:00:00 2001 From: "juliano.barbosa" Date: Mon, 3 Feb 2025 17:56:43 -0300 Subject: [PATCH] feat: enhance diagnostic keymaps setup and configure diagnostic display Signed-off-by: juliano.barbosa --- .clinerules | 0 init.lua | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .clinerules diff --git a/.clinerules b/.clinerules new file mode 100644 index 00000000..e69de29b diff --git a/init.lua b/init.lua index 7a1ca46a..7c5675e7 100644 --- a/init.lua +++ b/init.lua @@ -171,7 +171,12 @@ vim.opt.scrolloff = 10 vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +-- Set up diagnostic keymaps only after VimEnter to ensure diagnostic module is loaded +vim.api.nvim_create_autocmd('VimEnter', { + callback = function() + vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + end, +}) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which @@ -234,6 +239,15 @@ vim.keymap.set('n', 'taa', ':!make applyA', opts) -- [[ JMB End ]] +-- Configure diagnostic display +vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + update_in_insert = false, + severity_sort = true, +}) + -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'