Make C-[ exit Helix state in GUI Emacs #1

Merged
haze merged 1 commit from helix-esc into main 2026-07-08 12:23:24 -04:00
Owner

In GUI Emacs, C-[ produces byte 27 (ESC) which is bound to the global
meta-prefix map, so it never fires our [escape] bindings even when
Helix's minor-mode keymaps are active. Adopt evil-mode's approach:
install a menu-item with a :filter in input-decode-map keyed on ?\e.
The filter waits helix-esc-delay seconds for a follow-up key and, if
none arrives while a Helix state is active, translates ESC to
[escape]. Otherwise it returns the original ESC prefix map so
ESC-as-meta (e.g. 'ESC x' for 'M-x') keeps working.

In GUI Emacs, C-[ produces byte 27 (ESC) which is bound to the global meta-prefix map, so it never fires our [escape] bindings even when Helix's minor-mode keymaps are active. Adopt evil-mode's approach: install a menu-item with a :filter in input-decode-map keyed on ?\e. The filter waits helix-esc-delay seconds for a follow-up key and, if none arrives while a Helix state is active, translates ESC to [escape]. Otherwise it returns the original ESC prefix map so ESC-as-meta (e.g. 'ESC x' for 'M-x') keeps working.
Make C-[ exit Helix state in GUI Emacs
Some checks failed
CI / build (29.4, true) (pull_request) Has been cancelled
CI / build (30.2, true) (pull_request) Has been cancelled
CI / build (29.4, true) (push) Has been cancelled
CI / build (30.2, true) (push) Has been cancelled
28cc7005ed
In GUI Emacs, C-[ produces byte 27 (ESC) which is bound to the global
meta-prefix map, so it never fires our [escape] bindings even when
Helix's minor-mode keymaps are active. Adopt evil-mode's approach:
install a menu-item with a :filter in input-decode-map keyed on ?\e.
The filter waits helix-esc-delay seconds for a follow-up key and, if
none arrives while a Helix state is active, translates ESC to
[escape]. Otherwise it returns the original ESC prefix map so
ESC-as-meta (e.g. 'ESC x' for 'M-x') keeps working.
haze merged commit 28cc7005ed into main 2026-07-08 12:23:24 -04:00
haze deleted branch helix-esc 2026-07-08 12:23:24 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
haze/helix-mode!1
No description provided.