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

Bug: No yank highlight when using Y (remaps) #3

Open
chrisgrieser opened this issue Dec 20, 2023 · 4 comments
Open

Bug: No yank highlight when using Y (remaps) #3

chrisgrieser opened this issue Dec 20, 2023 · 4 comments

Comments

@chrisgrieser
Copy link

Using the vimrc plugin, I have: nnoremap Y y$

When I yank something with y, the highlight appears just fine. When I yank with Y, no highlight appears.

@aleksey-rowan
Copy link
Owner

aleksey-rowan commented Dec 21, 2023

That makes sense, thank you for reporting. Codemirror-vim doesn't expose yank events (and I don't want to monkey-patch it), so I have to infer when a yank happens.

I have a couple of bad ideas on how to fix this.

@chrisgrieser
Copy link
Author

A simple solution could be to add a setting where the user can name extra yank characters like Y?

aleksey-rowan added a commit that referenced this issue Dec 22, 2023
Detects `Y` yanks in addition to the `y` command.

Relates #3
@aleksey-rowan
Copy link
Owner

Yes, adding a user setting will help and I though this could be a potential solution, but I don't think it's optimal as it adds more friction and forces the user to tinker with the settings. Also, if I add highlight on put/undo/redo later (which I want to do), I would need to add more settings in case any of these commands are also remapped.

As a temporary fix (and we all know how permanent they are), I added Y to highlight triggers which is only proper since Y yanks the whole line by default anyway. Check 1.0.8.

For a proper solution, I would like to snoop at the mappings if they are exposed by codemirror-vim and try to figure out when a remapped yank is called. If that fails, I'll probably go with the user setting approach.

@Dzhegash
Copy link

Yes, indeed, it is very necessary to configure additional options for the selection keys, for example, I use map for "yiw" in Cyrillic it is "ншц" and with such a selection, the backlight does not work.

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

3 participants