In iTerm2
one can setup keyboard shortcuts so that for a given input sequence, iTerm2 sends a specific hex code to the terminal.
What exactly are these hex codes? And how can I identify a hex code for a given input key sequence?
In my case I am specifically interested in looking up the hex code
associated with Control + Alt + <char>
with char being u
,i
,j
,k
and l
.
I found this article that shows some examples of these conversions, but it doesn't list any Control + Alt + <char>
combinations.
The hope is that ultimately this will help me solve this other question in AskDifferent.
Best Answer
It's not a matter of looking up those keycodes, because in its default configuration iTerm2 doesn't do anything special for the keys. For instance, if you do
and press controlV ("literal next") before pressing each of those controlalt+character combinations, you're likely to find (as I did) that the result is just as if it ignored the alt modifier. The rather long answer in Sending Control+Alt+
<char>
to terminal in iTerm2 seems to have concluded something based on this default behavior which is not helpful.On the other hand, you can define a key binding, using hexadecimal values for the (ASCII) characters that you would like to send. In this screenshot, I have highlighted a binding that I added for controlaltf (lowercase
F
), which is0x66
:The
iIterm2
documentation is brief:but the screenshot here may help you understand what's needed.