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

feature(image): add option to `Snacks.image.hover()` to close immediately on cursor move

Open mehalter opened this issue 9 months ago • 4 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.

The image features of Snacks.image are great, but can be a bit overbearing when using the automatic inline or float options. Manually calling Snacks.image.hover() is a great alternative but then locks the hover to show until moving away from the treesitter node. This is not necessarily the desired behavior if you want to simply look at it for a moment and then have it go away.

Describe the solution you'd like

It would be nice to have an option passed into Snacks.image.hover() that makes it a lot more aggressive in closing. Where it shows the hover immediately, but then closes it the second the cursor moves or another operation happens rather than lingering until I move outside of the treesitter node.

Describe alternatives you've considered

Other solutions could be just homebrewing this in my own configuration that when I execute Snacks.image.hover it creates a single execution autocommand on cursormoved to check if there is a Snacks.image window and then close it if it exists. This seems a bit heavy to add in a user configuration and would make more sense to be upstreamed since it seems pretty generally useful for users.

Additional context

No response

mehalter avatar Mar 18 '25 13:03 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 18 '25 02:04 github-actions[bot]

This is not stale

mehalter avatar Apr 18 '25 03:04 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 19 '25 02:05 github-actions[bot]

This isn't stale

mehalter avatar May 19 '25 02:05 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 19 '25 02:06 github-actions[bot]

Not stale

mehalter avatar Jun 19 '25 02:06 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 30 '25 02:07 github-actions[bot]

not stale

mehalter avatar Jul 30 '25 02:07 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 01 '25 02:09 github-actions[bot]

Not stale

mehalter avatar Sep 01 '25 02:09 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 03 '25 02:10 github-actions[bot]

Not stale

mehalter avatar Oct 03 '25 02:10 mehalter

you can easily add this yourself with an autocmd

folke avatar Oct 20 '25 15:10 folke