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

Add an example to tutor how to yank & paste multiple selections using y and p bindings #11413

Open
dmitry-krasilnikov opened this issue Aug 3, 2024 · 2 comments
Labels
A-documentation Area: Documentation improvements C-enhancement Category: Improvements

Comments

@dmitry-krasilnikov
Copy link

dmitry-krasilnikov commented Aug 3, 2024

I think that yanking and pasting when working with multiple selections is quite a complicated feature. It took me some time, reading, and debugging paste_impl function just to realize that I need more than one selection in order to paste more than one selection I had previously yanked.

I believe adding this information with examples to tutor will be advantageous to anyone who hasn't had experience with multiple selections before.

@dmitry-krasilnikov dmitry-krasilnikov added the C-enhancement Category: Improvements label Aug 3, 2024
@RoloEdits
Copy link
Contributor

Is there another copy paste implimentation out there that wouldn't need you to select multiple lines to then paste over multiple lines? In every editor/browser/OS I have ever used this was always the case. What editor are you coming from that it would just override prior text rather than insert in, either where the cursor is or where the selection is?

@dmitry-krasilnikov
Copy link
Author

@RoloEdits I did not say that other editors implement it differently. All I said was that multiple selections is a complicated feature. I did not have any prior experience dealing with this feature coming from NeoVim and I wanted to contribute my perspective realizing that there are people like me out there who might not get the idea without documentation in helix.

What editor are you coming from that it would just override prior text rather than insert in, either where the cursor is or where the selection is?

I did not say anything about overriding text. My main confusion was that after yanking several selections with y and then pasting with p in a scratch buffer opened in a split view I only got the primary selection's contents, while what I had expected to happen was to insert the contents of all selections split among the same number of the original selections. I got that expectation after reading all the bits on yanking behavior in the book and after going through tutor. When I read the code and did some debugging I understood that there had to be the same number of selections at the location I wanted to paste into, then I figured that I had to first add new lines in a scratch buffer and then make multiple selection on each of those lines and only then pasting would produce the desirable result.

Btw, I am aware of join and yank feature, I use it all the time when I don't need to keep multiple selections after pasting. This issue was opened only because of the plain yank & paste behavior.

@kirawi kirawi added the A-documentation Area: Documentation improvements label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documentation Area: Documentation improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

3 participants