-
Notifications
You must be signed in to change notification settings - Fork 753
Ambiguous Keys
Alan edited this page Apr 4, 2022
·
3 revisions
For historical reasons, most terminals (except for some modern ones like Kitty, iTerm, and foot) send the exact same keycodes for different keys. For example, the <tab> key sends the same code as <c-i>. When Kakoune receives an ambiguous code, it has to decide what key to decode it to:
| This key | Decodes as |
|---|---|
<c-m> |
<ret> |
<c-j> |
<ret> |
<c-i> |
<tab> |
<c-h> |
<backspace> |
Therefore, if you map a key from the first column, the mapping will not trigger in the regular terminal UI. Instead, you should map the key from the right-hand column to achieve the same effect.
If you really want to map <c-m> instead of <ret> (because <c-m> has some mnemonic value, for example) you can make Kakoune manually trigger the first-column mappings in addition to the second-column mappings:
hook global normal RawKey <ret> %{ execute-keys -with-maps <c-m>; execute-keys -with-maps <c-j> }
hook global normal RawKey <tab> %{ execute-keys -with-maps <c-i> }
hook global normal RawKey <backspace> %{ execute-keys -with-maps <c-h> }
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV
