Hover
Usage #
Run :Lspsaga hover_doc
. If a hover window is opened, then the command would close it.
Use :Lspsaga hover_doc ++keep
if you want to keep the hover window. It will pin the hover window to the top right of your buffer.
Keymap example:
vim.keymap.set('n', 'K', '<cmd>Lspsaga hover_doc')
Prerequisite #
You need to install the Treesitter markdown
and markdown_inline
parser. If you are not sure if you have them, run :checkhealth
.
Why? Unlike the built-in hover, vim.lsp.buf.hover
, which uses regex syntax to render markdown, Lspsaga uses treesitter.
Default Options #
Default options in hover
section:
max_width = 0.9
defines float window widthmax_height = 0.8
defines float window heightopen_link = 'gx'
key for opening linksopen_cmd = '!chrome'
cmd for opening links
Advanced Configuration #
Lspsaga hover support opening external links in hover window. The default keybinding is gx
.
The default command is !open
on Mac, !explorer
on Windows, !wslview
on WSL, and !xdg-open
on Linux.
If these commands are not found, Lspsaga will use open_cmd
.
Workflow in GIF:
- Press
K
to open Lspsaga hover - Press
k
twice to jump into the hover window and view the doc - Press
gx
Highlight Group #
HoverNormal
hover window normal highlightHoverBorder
hover window border highlight