-
Notifications
You must be signed in to change notification settings - Fork 29
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
Option to preserve default/native Vim paste over behavior #11
Comments
Yeah, we can definitely add an option for this; yankstack actually used to behave this way. Let me explain what my problem was with it, and maybe you can help me decide what the behavior should be. Suppose, in your example, I yanked 'apple', then yanked 'grape', then highlighted 'cucumber' and pasted. The text now reads: apple With yankstack's current behavior, the contents of the stack are:
'cucumber' is on the bottom of the stack. Because the yankstack wraps around, I can cycle back to 'cucumber' by pressing With your proposed option turned on, how would the stack look? Maybe like this:
This has the advantage of keeping vim's default behavior when overwriting text in visual mode. But now, if I press either Let me know if this explanation makes sense, and what your thoughts are. |
Perhaps I should emphasize that currently, the top of the yankstack is synonymous with the default register. This is so that when you paste, you are always pasting the top item in the yankstack. |
Hi, I think that your suggested idea for how the stack should look with the Vim-style yank/paste makes sense, i.e.
This still agrees with the idea that the top of the yankstack is synonymous with the default register: pasting by default results in "cucumber" in either case. For the Same goes for |
Yes, your interpretation of the command is right, no matter which mode we're talking about: I just want to make sure you see the weirdness that I'm referring to though: Again, suppose you just selected 'cucumber' and pasted, replacing it with 'grape', and the stack looks like what you have above. Now, when you press Cycling the stack downward is slightly weird too: the first time you do it, you get 'coconut'. Then if you cycle back upward, you get 'cucumber'. But before you cycled at all, you had grape! So cycling the stack up and then down again puts you in a different state then when you first pasted. In summary, if we preserve vim's default pasting behavior in visual mode, we temporarily lose the correspondence between the top of the yankstack and the item being pasted. I still like the idea of adding the option. I just wanted to make sure to communicate the drawbacks that I'm seeing. |
Ok, I see what you mean. I guess it can be a little confusing if you are not familiar with the mechanics of what is going on. I think most users will just hit Alternatively, the only way I can think of out of this would be if the replaced text does not get added to the stack until after the paste is complete. Thus, when selecting |
I think this solution gives the behavior closer to what I expect to happen. I switched from yankring to yankstack because I wanted something that works exactly like vim except that I had access to recently yanked items. So I would want yankstack to only change what's put when I start cycling with (Yankstack does this in many ways, so thanks for the awesome plugin!) |
@pydave - Do you think that the problem being discussed here is the same as the one you identified in issue #19? Now that multiple people have brought it up, I think it deserves to at least be an option in yankstack. I would definitely merge a pull request that added it, and when I get some time, I may add it myself. Thanks for the feedback. |
This is probably another new issue, but just for the record, I've noticed that when clipboard gets unnamedplus included the behavior described changes as well. |
@aleprovencio I've opened another issue for that (#20). I hadn't even heard of |
@maxbrunsfeld no, #19 is an inconsistency between macros and live editing: It happens even if you put from a named register, so the default paste behavior is irrelevant. |
With native Vim, pasting on a visual selection/word/etc., then the entity being pasted over gets placed in the default register.
Thus, for example, given:
apple
grape
cucumber
by default, yanking "apple", then selecting "grape" and pasting will result in "grape" being placed in the default register; the next paste operation will put "grape".
Is there a way to preserve this with YankStack? Right now, with the above example, "apple" remains in the default register, and subsequent pastes put "apple". I would like for "grape" to be put by default (pushing "apple" one step down in the stack).
The text was updated successfully, but these errors were encountered: