Ah, escape codes… the long battle of pursuing real GUI goodness into the terminal.
Short story: I’ve battle with this with mixed degrees of success over the years. What I want is simple: disambiguate stupid legacy keys like C-i, C-h, and C-m with their counterparts and bind not-so-complex keystrokes like Ctrl+shift+anything or Alt+shift+anything, or whatever.
I had a little hack from wincent where I would map C-i
to F6
only in my
terminal, but it’s kinda hacky. Anyway… here are the resources:
Scan keycodes using kitty:
$ kitty +kitten show_key -m kitty
Also, check who implements this protocol in the kitty webpage. This is really important. That leaves us with not many terminal options:
- foot
- kitty
- WezTerm
Luckily, all of those are great. I guess no more alacritty. It might be implemented in st also. not sure
With all that set, here are some escape
sequences. In
case I need them again for any reason. Bottom line is that most bindings are
written in hex form, so Ctrl+shift+i would be \x1b[17~
. The \x1b[
corresponds to CSI, and then 17~
is what kitty shows for the key. Not a great
explanation, but I think I’ll understand if I ever read this again