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

feat(term): uniformize word-wise movement and deletion #2500

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

CBenoit
Copy link
Member

@CBenoit CBenoit commented May 18, 2022

Ctrl-Left and Ctrl-Right are common shortcuts in numerous applications.

This change is just adding a new key binding for the existing word-wise movement:

  • Ctrl-Left is equivalent to Alt-b and Alt-Left, and
  • Ctrl-Right is equivalent to Alt-f and Alt-Right.

EDIT: after reviews, changed to the following:

  • Adds Ctrl+{Left/Right/Backspace/Delete} for word-wise movement/deletion in prompt, picker, …
  • Removes Alt-Left and Alt-Right in prompt, picker, …
  • Adds Alt-Delete in insert mode for forward word deletion

In some terminals, Alt-Backspace might not work because it is ambigous.
See: #2193 (comment)
Hence, Alt alternative is not removed.

@the-mikedavis
Copy link
Member

Similarly for insert mode there was #2193

Should we remove the old A-Left and A-Right bindings so it lines up with the changes in that PR?

@CBenoit CBenoit force-pushed the prompt-ctrl-left-right branch 2 times, most recently from bacd99d to a89b147 Compare May 18, 2022 19:52
@the-mikedavis the-mikedavis added the S-waiting-on-review Status: Awaiting review from a maintainer. label May 18, 2022
@CptPotato
Copy link
Contributor

CptPotato commented May 19, 2022

I think Alt Backspace vs Ctrl Backspace is a similar story. (I prefer the latter one)

@archseer
Copy link
Member

Feel free to open a PR with those changes too 👍🏻

@archseer
Copy link
Member

Should we remove the old A-Left and A-Right bindings so it lines up with the changes in that PR?

Yeah I agree, let's remove the ctrl bindings.

@CBenoit
Copy link
Member Author

CBenoit commented May 20, 2022

Should we remove the old A-Left and A-Right bindings so it lines up with the changes in that PR?

Yeah I agree, let's remove the ctrl bindings.

Just to be sure, did you mean "alt bindings"?

@archseer
Copy link
Member

Ah yeah sorry 😅

@CBenoit CBenoit force-pushed the prompt-ctrl-left-right branch 3 times, most recently from 9482527 to 503525e Compare July 6, 2022 11:04
@CBenoit
Copy link
Member Author

CBenoit commented Jul 6, 2022

I updated the PR and rebased on master. Should be ready I think. Looks good to you @pickfire ?

Ctrl-based shortcuts are common in numerous applications.

This change:
- Adds Ctrl+{Left/Right/Backspace/Delete} for word-wise movement/deletion in prompt, picker, …
- Removes Alt-Left and Alt-Right in prompt, picker, …
- Adds Alt-Delete in insert mode for forward word deletion

In some terminals, Alt-Backspace might not work because it is ambigous.
See: helix-editor#2193 (comment)
Hence, Alt alternative is not removed.
@CBenoit CBenoit changed the title feat: add Ctrl+{Left/Right} for word-wise movement feat(term): uniformize word-wise movement and deletion Jul 6, 2022
Comment on lines +486 to +487
ctrl!('w') | alt!(Backspace) | ctrl!(Backspace) => self.delete_word_backwards(cx),
alt!('d') | alt!(Delete) | ctrl!(Delete) => self.delete_word_forwards(cx),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this alt behavior is not needed since we have ctrl, but yeah I am fine with this for now given that alt does not have good use yet.

Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks.

@pickfire pickfire merged commit 333ab27 into helix-editor:master Jul 15, 2022
thomasskk pushed a commit to thomasskk/helix that referenced this pull request Sep 9, 2022
…2500)

Ctrl-based shortcuts are common in numerous applications.

This change:
- Adds Ctrl+{Left/Right/Backspace/Delete} for word-wise movement/deletion in prompt, picker, …
- Removes Alt-Left and Alt-Right in prompt, picker, …
- Adds Alt-Delete in insert mode for forward word deletion

In some terminals, Alt-Backspace might not work because it is ambigous.
See: helix-editor#2193 (comment)
Hence, Alt alternative is not removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants