Make paste behavior more consistent when handling multiple cursors. #10200
Unanswered
lukelafountaine
asked this question in
Ideas
Replies: 2 comments
This comment has been hidden.
This comment has been hidden.
-
This is a great suggestion. I would consider making this an official change request in the issue tracker. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First off, I'd just like to say that I really appreciate all the work that's gone into the development of Helix. It's a great editor and I really enjoy using it.
However, I've noticed a few small rough edges related to pasting with multiple cursors that we may be able to improve:
Pasting when you have more or fewer selections than cursors. The current behavior in Helix is this: You yank n selections and then:
To me, this is unexpected. I can't really think of a situation where I'd want Helix to repeat the last selection multiple times. It's also not consistent which from what I understand is what Helix strives for. I suggest that we follow the behavior that other editors, like VSCode and Sublime, use: If the number of selections equals the number of cursors, paste one selection per cursor. Otherwise, paste all selections at each cursor. That's one less special case than Helix's existing behavior. It also matches behavior that many users coming from other editors are likely already familiar with.
This suggested change would also improve a somewhat tangential oddity: currently if you make several selections, yank them, remove the primary selection, and then paste, the value pasted at each cursor would be off-by-one from what you might expect.
Pasting multi-line text from the system clipboard into multiple Helix cursors. Currently, Helix will always paste the entire system clipboard at all cursors. This makes sense most of the time. However, if the clipboard selection is multiple lines and has the same number of lines as there are cursors, it makes sense to paste one line from the clipboard at each cursor. This matches the behavior of both VSCode and Sublime, so I'd think that many people would expect that behavior. It also would be more consistent with the way things work when they are yanked within Helix, regardless if we make the change suggested above.
Here's an example use case: I have some kind of math formula in several places in a text file. I want to replace those formulas with the value that each evaluates to. I'd like to use multiple cursors to select each of the formulas, yank them into the system clipboard, paste those into Excel, do whatever calculations I need to, copy the calculated values from Excel and paste them back into their respective cursors in Helix.
It's been suggested that you can solve this problem by doing something like this:
:new<enter><space>P<Alt-s>y:bc!
and map to a custom keybinding, if desired. That works, but it really seems to me like functionality that should be native to the editor.Please let me know what you think of these suggestions. I'd be interested in submitting a PR if the implementation isn't too much more complicated than I'm imagining.
Beta Was this translation helpful? Give feedback.
All reactions