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

Add new command to jump to chunks instead of just words #10015

Closed
qwerty01 opened this issue Mar 27, 2024 · 0 comments
Closed

Add new command to jump to chunks instead of just words #10015

qwerty01 opened this issue Mar 27, 2024 · 0 comments
Labels
C-enhancement Category: Improvements

Comments

@qwerty01
Copy link

For context, this feature request is related to #510 and the implementation in #8875.

Currently the way the amp-like jump command works is by filtering by words. This is the best choice for the default command, however, I would like to propose a second command which works on what I would like to call "chunks". There are times where instead of jumping and selecting a whole word, selecting part of a word is desired. An example would be changing OnceCell to OnceLock, instead of jumping to the beginning of the word and selecting the whole thing, jumping to the second part of the word, Cell would allow a replacement to be done in 1 keystroke.

Current implementation:
image

New command:
image

it would also add a new jump command:
image

I've got a proof of concept here for how it would work, I'll rebase it to 24.03 and create a PR once that version is released.

Some open questions to answer:

  • Currently I have it set up so that underscores are included in the selection, that way you can delete a full part of a word in one stroke; replacement would require adding _ back in, so I'm not sure if this is the right approach
  • Would it be worth adding in some movement keys to also move by chunks? That would probably be best as a separate PR, but since the functionality would already be there, it might be worth considering
  • Currently the way reverse searching is implemented is by reversing the iterator of characters. This works for all the other jump options (words, etc) since they're reversible, but doesn't work for chunks, since one chunk boundary is from a lowercase letter to an uppercase letter and not vice-versa, I added in a hack to swap the characters it's checking when it's searching for reverse chunks, but it might be worth finding a better solution.
@qwerty01 qwerty01 added the C-enhancement Category: Improvements label Mar 27, 2024
@helix-editor helix-editor locked and limited conversation to collaborators Mar 27, 2024
@the-mikedavis the-mikedavis converted this issue into discussion #10016 Mar 27, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

1 participant