From a7e213e4f4810320205d12f1c0bff1033bd1aba9 Mon Sep 17 00:00:00 2001 From: Marc-Anthony Girard Date: Wed, 26 Feb 2025 23:35:38 -0500 Subject: [PATCH] feat: add `vim.diagnostic.open_float` --- init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init.lua b/init.lua index 5cac3d14..26add218 100644 --- a/init.lua +++ b/init.lua @@ -164,8 +164,16 @@ vim.opt.scrolloff = 10 vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps +-- See `:help setloclist` vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +-- Show diagnostic under cursor in floating window. +-- Alternative to virtual text when it overflow over the buffer +-- See `:help open_float` +vim.keymap.set('n', 'xl', function() + vim.diagnostic.open_float { scope = 'line' } +end, { desc = 'Show [L]ine Diagnostics' }) + -- 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 -- is not what someone will guess without a bit more experience.