helix: Ctrl + [ doesn't function as Escape in helix 23.03
I think this is because of the new enhanced keyboard protocol enabled in 23.03. Is there a way to disable it? Although I can remap Ctrl+[ to mode change command, escape has more functions than only mode change. For example, when you enter : to type command, you can’t return back to normal mode using Ctrl+[. And there is no way to remap a key combination to a specific keycode in helix, which is available in vim.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 18
- Comments: 21 (4 by maintainers)
Commits related to this issue
- helix: Map Ctrl-[ to leave insert mode This is required due to a regression in Helix 23.03, reported at https://github.com/helix-editor/helix/issues/6551 — committed to srstevenson/dotfiles by srstevenson a year ago
- feat(editor): Allow Ctrl-[ to function as Escape Issue: https://github.com/helix-editor/helix/issues/6551 — committed to harritaylor/helix by harritaylor a year ago
- Add keymap to reenter normal mode from insert mode - use familiar ctrl + [ (left bracket) mapping - see helix-editor/helix#6551 for discussion — committed to djpowers/dotfiles by djpowers 9 months ago
Ctrl + [is the de facto standardescalternative on macOS, and I don’t think the usage is niche, becauseCtrl + [is especially useful when your keyboard does not have anesckey (which is true for many Mac/iPad users). I’m really looking forward to the upcomingescremapping feature.but this workaround can’t substitute all the esc usage with ‘Ctrl-[’, so a feature of keycode remapping should be the best solution.
I also don’t think that using
ctrl+[asescis a niche use-case, on keyboards with us-layout it is more comfortable to reach (both pinkies) than the actualesc.For what it’s worth you can run hx inside tmux for the moment as a workaround.
My
C-[muscle memory is so strong that I also do it at prompts and in pickers, which are not currently re-mappable in Helix (that I can find, at least). Would be nice to have it mapped there too.Yes I agree, I think all of this talk of
C-[being an accident is a little dismissive. Perhaps it was an ‘accident’ once but its usage is certainly not niche (as this issue proves). The reality is that many people expect and rely on this behaviour. This just hit me today as Alacritty 0.13.0 now implements the kitty keyboard protocol.Came here as someone who has been evangelizing mapping CAPS LOCK to CTRL and then using ctrl-[ in vim for over 20 years now. Specifically as someone who has RSI issues and is able to use caps_lock-[ with two very subtle finger movements vs. any alternative. If it was a mere accident that that worked, it’s an accident that was true for every combination of vi/vim/nvim/etc. in every terminal emulator and every operating system I’ve ever used.
To advocate for
Ctrl + [users.They are in their right to notice, this is a very old behavior in VT100 terminal that
Ctrl+ [does produce the escape sequence.To verify that, we may simply use
cat:catWe press Escape That does print^[Now we pressCtrl + [That does also print^[Further documentations can be found with keywords: control-escape sequence VT100
I do personally, as a non-Qwerty keyboard user, have to use the key combo
Ctrl + AltGr + 4to outputCtrl + [.However I do warmly recommend that Helix supports
Ctrl + [as the escape sequence due to legacy reasons.Hi, just came here to say hat I love helix, and wanted to voice my support that mapping control to caps lock and using C-[ is not a niche use case and should please have first class support. Since I am just some guy on the internet, I’ll try to supplement my argument with some appeals to authority in hopes that this rhetorical flourish will convince people 😃
I can also try and hop on to help with the implementation if this is a resource issue.
These two other control character mappings, backspace
ctrl-hand line feedctrl-j, are still supported after the enhanced keyboard protocol change, so I don’t think it is a stretch to keep supportingctrl-[as escape by default.There is a couple of settings in
~/.tmux.confthat affects the behavior of the escape sequence, and may help with this issue.In particular the following:
set -sg escape-time 0In Helix, found the following mapping to be particularly efficient: Ctrl + space
In case it helps anyone… until Helix supports this, using keyd to map
C-[to escape seems to work.If tmux doesn’t support the disambiguation of ctrl-[ and esc, then shouldn’t ctrl-[ work as esc in helix? or am I misunderstanding something?
@sdemura, almost 😃 what you want is: