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

Avoid pasting from the blackhole register #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sosmo
Copy link

@sosmo sosmo commented Sep 1, 2015

Yankstack's mappings (line 170) rely on Vim's v:register variable to define the currently active register. However, there's one oddity about the v:register: after yanking/deleting something its value doesn't update until the cursor is moved or some other action is performed (try doing "_x:echo v:register, apparently it's intended). That means that if you delete something into the blackhole register for instance, and then immediately use Yankstack to paste without specifying a register, the paste_with_key function receives the previously used _ in the parameter a:register instead of " which is what the user would expect. In other words, Yankstack will try to paste from the blackhole register instead of the default register with p if the previous command used the blackhole reg.

The commit simply transforms the blackhole register into default register when pasting. This fixes pasting with plain p so you can do "_xP for instance. Pastes using an explicit register are unaffected, apart from the blackhole register which I don't think anybody has any reason to paste from.

I haven't tested the commit with the suite since I'm unfamiliar with Ruby and kind of preoccupied. It's been working for me for a while though and it seems like a harmless change.

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

Successfully merging this pull request may close these issues.

None yet

1 participant