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: add CTRL+[ binding as <Esc> alias #1787

Merged
merged 1 commit into from Feb 28, 2024
Merged

feat: add CTRL+[ binding as <Esc> alias #1787

merged 1 commit into from Feb 28, 2024

Conversation

liljaylj
Copy link
Contributor

in Vim/Neovim there is alias for <Esc> mapping -- <C-[>. it is useful if your <Esc> key is hard to hit on your keyboard.

for reference:

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

in Vim/Neovim there is alias for `<Esc>` mapping -- `<C-[>`. it is useful if
your `<Esc>` key is hard to hit on your keyboard.

for reference:

    https://vimhelp.org/insert.txt.html#i_CTRL-%5B
    https://neovim.io/doc/user/insert.html#i_CTRL-%5B
@tessus
Copy link
Contributor

tessus commented Feb 28, 2024

2 questions:

  1. on which keyboard is Esc hard to hit - just asking out of curiosity because I have only seen the Esc key in the top left corner: us-en, german, korean, spanish, ...

  2. does this shortcut work in terminal multiplexers?

@akinomyoga
Copy link
Contributor

  1. on which keyboard is Esc hard to hit - just asking out of curiosity because I have only seen the Esc key in the top left corner: us-en, german, korean, spanish, ...

I actually always use C-[ to send ESC because I have difficulty in pressing ESC. Only when I use the keyboard of a laptop machine, without breaking the home position, I can reach ESC with my little finger. On all the keyboards of the full size, it's impossible for me to reach the ESC key.

  1. does this shortcut work in terminal multiplexers?

This PR is only relevant when an advanced keyboard protocol is enabled. If the advanced keyboard protocol is enabled, it should work better in terminal multiplexers because the protocol is free from the heuristic and obscure distinction of Meta modifier vs ESC, which the terminal multiplexer needs to process. (But, I'm not sure crossterm supports enabling the advanced keyboard protocol of the outside terminal when terminal multiplexers are involved.)

Copy link
Contributor

@akinomyoga akinomyoga left a comment

Choose a reason for hiding this comment

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

For the exactly same reasons as #1720, I agree to have this binding.

@tessus
Copy link
Contributor

tessus commented Feb 28, 2024

Isn't there already ctrl-c and ctrl-g an alias to Esc? At least in my atuin, ctrl-c and ctrl-g exits atuin the same way as Esc does.

@akinomyoga
Copy link
Contributor

ESC and C-[ are equivalent in the traditional terminal protocol, and we should assign the same functionality to both even in the advanced keyboard protocol unless we would drop the support for the traditional terminal protocols.

Given C-c and C-g already exit the Atuin session, another option would be to remove the keybinding to ESC, but that doesn't seem useful to me.

Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

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

thank you!

Seeing as this is your first time contributing, if you would like a holographic contributors-only Atuin sticker, then please fill out this form!

We do also have a Discord if you'd like to ask any questions, or just fancy hanging out!

@ellie ellie merged commit 22a9b49 into atuinsh:main Feb 28, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants