Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Using a count for a motion should select all text traversed #536

Closed
Omnikar opened this issue Jul 30, 2021 · 9 comments · May be fixed by #1570
Closed

Using a count for a motion should select all text traversed #536

Omnikar opened this issue Jul 30, 2021 · 9 comments · May be fixed by #1570
Labels
A-keymap Area: Keymap and keybindings C-discussion Category: Discussion or questions that doesn't represent real issues

Comments

@Omnikar
Copy link
Contributor

Omnikar commented Jul 30, 2021

Currently, using a count for a motion, such as 2w will behave exactly the same selection-wise as pressing w 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; so 2w will behave like v2w. This would allow for operations like 2wd as a counterpart to d2w in Vim.

@pickfire pickfire added A-keymap Area: Keymap and keybindings C-discussion Category: Discussion or questions that doesn't represent real issues labels Aug 2, 2021
@pickfire
Copy link
Contributor

pickfire commented Aug 2, 2021

I have thought about this in the past. Both way seemed to work for me.

@cessen
Copy link
Contributor

cessen commented Aug 3, 2021

2w will behave exactly the same selection-wise as pressing w 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 like v2w.

But isn't that what v is for?

@sj4nes
Copy link

sj4nes commented Aug 3, 2021

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.

@archseer
Copy link
Member

archseer commented Aug 4, 2021

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: #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.

@cessen
Copy link
Contributor

cessen commented Aug 4, 2021

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.

@Omnikar
Copy link
Contributor Author

Omnikar commented Aug 4, 2021

On second thought, I suppose the way it works now is actually fine.

@Omnikar Omnikar closed this as completed Aug 4, 2021
@pickfire
Copy link
Contributor

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.

@Omnikar Omnikar reopened this Nov 17, 2021
@EpocSquadron
Copy link
Contributor

I'd be willing to trial this if there's a branch somewhere I can pull down.

This was referenced Nov 26, 2021
@sudormrfbin sudormrfbin linked a pull request Jan 24, 2022 that will close this issue
3 tasks
@sudormrfbin
Copy link
Member

I'd be willing to trial this if there's a branch somewhere I can pull down.

@EpocSquadron there's #1570 open now.

@helix-editor helix-editor locked and limited conversation to collaborators Apr 11, 2024
@pascalkuthe pascalkuthe converted this issue into discussion #10351 Apr 11, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
A-keymap Area: Keymap and keybindings C-discussion Category: Discussion or questions that doesn't represent real issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants