snacks.nvim icon indicating copy to clipboard operation
snacks.nvim copied to clipboard

feature: Snack.image.hover quick dismissal

Open Krystian-KF opened this issue 1 week ago • 0 comments

Did you check the docs?

  • [x] I have read all the snacks.nvim docs

Is your feature request related to a problem? Please describe.

When you are in a middle of long and complex multiline code block containing latex/mermaid equation and the hover preview is invoked, currently you need to get the cursor line out of the code block to pop up preview disappear. It means a lot of scrolling or jumping out, which is a bit cumbersome especially that your view is now obscured. Another thing is that this is inconvenient as you might want to have just a quick preview and dismiss it without losing your current position.

Example:

https://github.com/user-attachments/assets/8323340f-ad4f-426d-8565-443f8b5bd785

Describe the solution you'd like

  1. One option would be to provide a key map for the pop up preview to dismiss but this might be inconvenient itself as you would need to first focus it. Maybe similar behaviour to how vim.lsp.buf.hover() works. Press K once for the popup, press K second time to focus it, press q to dismiss.
  2. Another solution, the one I would prefer, would be to implement Snacks.image.hover() as a toggle. It would invoke preview when there is none and close if there is already one.

Describe alternatives you've considered

Standard vim motions to get out of the code block.

Additional context

No response

Krystian-KF avatar Feb 18 '25 05:02 Krystian-KF