Skip to content

Commit a7e213e

Browse files
committed
feat: add vim.diagnostic.open_float
1 parent 34e7d29 commit a7e213e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

init.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,16 @@ vim.opt.scrolloff = 10
164164
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
165165

166166
-- Diagnostic keymaps
167+
-- See `:help setloclist`
167168
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
168169

170+
-- Show diagnostic under cursor in floating window.
171+
-- Alternative to virtual text when it overflow over the buffer
172+
-- See `:help open_float`
173+
vim.keymap.set('n', '<leader>xl', function()
174+
vim.diagnostic.open_float { scope = 'line' }
175+
end, { desc = 'Show [L]ine Diagnostics' })
176+
169177
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
170178
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
171179
-- is not what someone will guess without a bit more experience.

0 commit comments

Comments
 (0)