Closed Omnikar closed 2 months ago
I have thought about this in the past. Both way seemed to work for me.
2w
will behave exactly the same selection-wise as pressingw
twice
I'm not sure I follow why that's undesirable. That's how most commands behave: the number prefix is simply a repeat count.
so
2w
will behave likev2w
.
But isn't that what v
is for?
The Kakoune behavior could be described as "Always Be Selecting". 2w selects the next two words--the movement of the cursor is a side effect. I find that if the highlighted selection is too broad or want to reset it, I just click Space, and the anchor snaps back to the cursor in its current position (in Kakoune).
When I use v
in Helix a stumble for me is how to easily cancel the highlighted selection to start over with the current cursor location.
2w selects the next two words
kak: 2w
selects the second word for me, whereas 2W
will select two words.
When I use
v
in Helix a stumble for me is how to easily cancel the highlighted selection to start over with the current cursor location.
I think you can ESC
to leave extend mode, then ;
to collapse the selection. There's also this proposal: https://github.com/helix-editor/helix/pull/461
I also wondered if ESC
in normal mode could be used for this. So ESC
ESC
would exit extend mode, then collapse the selection.
I also wondered if ESC in normal mode could be used for this. So ESC ESC would exit extend mode, then collapse the selection.
For what it's worth, I map Esc
in normal mode to keep_primary_selection
. I kept intuitively pressing Esc
in normal mode thinking it would clear multiple cursors, but when all secondary cursors were off screen I couldn't tell they were still there, and I'd happily keep editing away. It resulted in many instances of messed up files that were painful to fix while still retaining the (intentional) edits I had made.
I basically think of Esc
in normal mode as "get back to a 'clean slate' editor state". Ideally I'd like that to a be a single cursor, but reducing to the primary selection is close enough for now.
On second thought, I suppose the way it works now is actually fine.
I realized I find this useful now, can we reopen it?
I find myself pressing v way more than ;, almost had to press v every time, sometimes I know the count, I wish if I press the count it will select all the way from current position (not extending) so I can perform an action on this. The behavior will be similar to current 10xd
(to delete 10 lines) rather than v10xd
. So every time after a movement, the whole thing will be selected rather than the last thing so user can perform action on the whole thing.
I'd be willing to trial this if there's a branch somewhere I can pull down.
I'd be willing to trial this if there's a branch somewhere I can pull down.
@EpocSquadron there's #1570 open now.
Currently, using a count for a motion, such as
2w
will behave exactly the same selection-wise as pressingw
twice. I think this should be changed so that using a count for a motion will select the text traversed by all repetitions of the motion; so2w
will behave likev2w
. This would allow for operations like2wd
as a counterpart tod2w
in Vim.