🗒 Bindkeys Map
Bindkey
The bindkey
key mappings can be very confusing to decipher. It can use multiple different notations but it's smart to use the same key notation throughout your configuration. You can print all of your current key bindings in the current keymap with bindkey
. To print the full bindkey
command to add to your .zshrc
file use bindkey -L
.
In general, you'll bind a widget so a key sequence or a key with a modifier. This can be declared in caret notation using ^
, using escape sequences using \
, in octal (\NNN
), hex (\xNN
), or Unicode (\uNNNN
). None of these are particularly great for people to read. This is also tricky because it depends on your keyboard, operating system, and shell.
Here are some basics:
\e
,\E
, = Escape^[
= Alt key (on some keyboards this is the same as escape)^?
= Delete^X
,^
= Control
The keys that come after the modifier can add more confusion.
Delete key binding
To delete a key binding you can use bindkey -d $KEYS
. Make sure you don't delete the characters you need for typing.
The bindmap'…'
keybindings
Sometimes plugins call bindkey to assign keyboard shortcuts. This can cause problems because multiple plugins can bind the same keys.
Also, the user might want a different binding(s), which will require complicated, additional bindkey
commands in .zshrc
.
Zi provides a solution to this problem – the ability to remap the bindkeys with a short ice-modifier bindmap'…'
.
Examples for bindmap'…'
Map Ctrl-G instead of Ctrl-R for the history searcher.
zi bindmap'^R -> ^G' for z-shell/history-search-multi-word