feat(nvim): add scrollable hover docs with rounded border
- Configure K to show hover docs in floating window with rounded border - Add <C-j>/<C-k> keymaps to scroll hover documentation - Enable lsp_doc_border in noice for consistent styling https://claude.ai/code/session_01UcDoC4n6CWMttYFJPw17ie
This commit is contained in:
parent
9ff2996863
commit
c8336a73ac
2 changed files with 18 additions and 2 deletions
|
|
@ -45,7 +45,23 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
end, opts) -- jump to next diagnostic in buffer
|
end, opts) -- jump to next diagnostic in buffer
|
||||||
|
|
||||||
opts.desc = 'Show documentation for what is under cursor'
|
opts.desc = 'Show documentation for what is under cursor'
|
||||||
keymap.set('n', 'K', vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
|
keymap.set('n', 'K', function()
|
||||||
|
vim.lsp.buf.hover { border = 'rounded' }
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
opts.desc = 'Scroll hover docs down'
|
||||||
|
keymap.set('n', '<C-j>', function()
|
||||||
|
if not require('noice.lsp').scroll(4) then
|
||||||
|
return '<C-j>'
|
||||||
|
end
|
||||||
|
end, { buffer = ev.buf, silent = true, expr = true })
|
||||||
|
|
||||||
|
opts.desc = 'Scroll hover docs up'
|
||||||
|
keymap.set('n', '<C-k>', function()
|
||||||
|
if not require('noice.lsp').scroll(-4) then
|
||||||
|
return '<C-k>'
|
||||||
|
end
|
||||||
|
end, { buffer = ev.buf, silent = true, expr = true })
|
||||||
|
|
||||||
opts.desc = 'Restart LSP'
|
opts.desc = 'Restart LSP'
|
||||||
keymap.set('n', '<leader>rs', ':LspRestart<CR>', opts) -- mapping to restart lsp if necessary
|
keymap.set('n', '<leader>rs', ':LspRestart<CR>', opts) -- mapping to restart lsp if necessary
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ return {
|
||||||
command_palette = true, -- position the cmdline and popupmenu together
|
command_palette = true, -- position the cmdline and popupmenu together
|
||||||
long_message_to_split = true, -- long messages will be sent to a split
|
long_message_to_split = true, -- long messages will be sent to a split
|
||||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
lsp_doc_border = true, -- add a border to hover docs and signature help
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue