How to remove a zsh keybinding if I don't know what it does?

After some searching, I've found the answer:

To discover what escape sequence the key combination is triggering, follow this excellent answer:

echo "CtrlVEsc/"

Which displays, for me, as: echo "^[/". CtrlV forces the following key to display as an escape sequence instead of being interpreted. So now we know we're trying to find what is bound to "^[/".


To list all zsh key bindings, simply execute bindkey with no args:

$ bindkey
"^A"-"^C" self-insert
"^D" list-choices
"^E"-"^F" self-insert
"^G" list-expand
"^H" backward-delete-char
...
"^Y"-"^Z" self-insert
"^[" vi-cmd-mode
"^[," _history-complete-newer
"^[/" _history-complete-older   ### <--- Here it is.
"^[M" vi-up-line-or-history
"^[OA" vi-up-line-or-history
...
"^\\\\"-"~" self-insert
"^?" backward-delete-char
"\M-^@"-"\M-^?" self-insert

So, having decided that I don't care about _history-complete-older, I'm just going to remove it. I added this to my .zshrc:

# Unbind the escape-/ binding because it gets triggered when I try to do a history search with "/".
bindkey -r "^[/"

If, instead, you just want to rebind it to some other key, you might use:

bindkey -r "^[/"
bindkey "<some-other-key-combo>" _history-complete-older

It is probably

% bindkey '^[/'
"^[/" _history-complete-older
%

or similar. And that's how you find out.

Further reading

  • Paul Falstad (2015-12-02). "ZLE builtins". Z Shell Manual. 5.2.

Also related is the KEYTIMEOUT setting, which indicates how long ZSH will wait to detect multi-key sequences, minimized by setting:

KEYTIMEOUT=1

If you're feeling super extreme, you can also remove all the ESC-something binds, so that ZSH has no multi-key sequences it will waste time waiting for following the escape key being pressed.

bindkey -rpM viins '^['
bindkey -rpM vicmd '^['