Avoid pasting from the blackhole register #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Yankstack's mappings (line 170) rely on Vim's
v:register
variable to define the currently active register. However, there's one oddity about thev: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, thepaste_with_key
function receives the previously used_
in the parametera: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 withp
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.