Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] add highlight to the yanked region #121

Open
aleksey-rowan opened this issue Apr 30, 2023 · 7 comments
Open

[feature request] add highlight to the yanked region #121

aleksey-rowan opened this issue Apr 30, 2023 · 7 comments

Comments

@aleksey-rowan
Copy link

Please add an option to highlight the yanked region like in https://github.com/machakann/vim-highlightedyank or natively in Neovim. Thanks!

@nightwing
Copy link
Collaborator

@sergeichestakov should we add this feature, or should we limit the scope to vim defaults only?

@sergeichestakov
Copy link
Contributor

yeah I think we'll want to stick with defaults as close as possible. we can possibly add it as a config option tho

@aleksey-rowan
Copy link
Author

yeah I think we'll want to stick with defaults as close as possible. we can possibly add it as a config option tho

I understand the importance to sticking with the defaults and avoiding scope creep, but if this can be added an an option, that would be amazing. Highlighting yanks is one of those quality-of-life features--I believe--that almost everyone adds to their configs right away.

Thank you for considering this anyway!

@joelostblom
Copy link

This is actually available as a default in Neovim, and it is super helpful. Especially for confirming the yanked region (especially when grabbing a paragraph or targeting a character where it is easy to overlook that there is another of the same character earlier or grab an extra whitespace), and also for teaching/presenting so that others can easily follow along what you are doing. I raised this in the jupyterlab-vim repo originally jupyterlab-contrib/jupyterlab-vim#117 and posted this example:

@aleksey-rowan
Copy link
Author

Shameless plug here. I made an Obsidian plugin to do just that--highlight the yanked region. If you are using Obsidian and were missing that feature, check it out:

https://github.com/aleksey-rowan/obsidian-vim-yank-highlight

@joelostblom
Copy link

That's great, thank you @aleksey-rowan ! Is there anything from your approach that would be useful/able to be transferred over if this feature is approved to be added in codemirror directly? Or is it completely different to implement it in obsidian?

@aleksey-rowan
Copy link
Author

@joelostblom, there is almost nothing Obsidian-specific apart from the plugin wrapper, so I think the same approach can be added to the codemirror-vim directly. It should be even easier since you can hook into the pushTest/yank handler instead of listening to key events and then trying to find yanked text in the viewport.

There is another Obsidian yank plugin that does a similar thing by monkey-patching codemirror-vim, so their approach would be even more adaptable to be bundled in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants