bindkey -s in-string out-string
binds in-string
to out-string
. If in-string
is typed out-string
is pushed back and treated as input.
The actual codes (for example
^[Oq
) may be different on your system. You can press Ctrl+vfollowed by the key in question to get the code for your terminal.
Snippet of ~/.zshrc from my machine (Macbook Pro 15" Retina):
# Setting Keypad info:
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
bindkey -s "^[Os" "3"
bindkey -s "^[Ot" "4"
bindkey -s "^[Ou" "5"
bindkey -s "^[Ov" "6"
bindkey -s "^[Ow" "7"
bindkey -s "^[Ox" "8"
bindkey -s "^[Oy" "9"
bindkey -s "^[Op" "0"
bindkey -s "^[OX" "="
bindkey -s "^[Oo" "/"
bindkey -s "^[Oj" "*"
bindkey -s "^[Om" "-"
bindkey -s "^[Ok" "+"
bindkey -s "^[OM" "^M"
bindkey -s "^[On" "."
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
bindkey -s "^[Os" "3"
bindkey -s "^[Ot" "4"
bindkey -s "^[Ou" "5"
bindkey -s "^[Ov" "6"
bindkey -s "^[Ow" "7"
bindkey -s "^[Ox" "8"
bindkey -s "^[Oy" "9"
bindkey -s "^[Op" "0"
bindkey -s "^[OX" "="
bindkey -s "^[Oo" "/"
bindkey -s "^[Oj" "*"
bindkey -s "^[Om" "-"
bindkey -s "^[Ok" "+"
bindkey -s "^[OM" "^M"
bindkey -s "^[On" "."