How do I disable a keybinding if I don't know what it is or what it's triggering?

I have my zsh key mode set to vi-mode, through bindkey -v.

To do a history search, I press Esc to get to "command mode", and then / to start the search. However, if I press them too fast, it does something else, but I don't know what! I assume Esc-/ is some keybinding, but I don't know what it is. How do I find this and turn it off?

4 Answers 4


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
  • 3
    You can actually look up a specific key binding by passing it as single argument to bindkey without other options: bindkey '^[/'.
    – Adaephon
    May 25, 2016 at 9:46

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.

This question has two parts,

  1. how do I find out what the mapping does?
  2. how do I unbind the mapping?

how do I find out what the mapping does?

as mentioned in other answers

bindkey <key_combination>

this will print the zle command related to the key combination

how do I unbind the mapping?

bindkey -r <key_combination>

reference - http://zsh.sourceforge.net/Guide/zshguide04.html#l95

  • 1
    Do you know why bindkey -rp '^' doesn't have any effect, but bindkey -rp '^[' and -rp '^X' do?
    – Pound Hash
    Mar 3, 2022 at 21:52

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


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 '^['
  • I think multi-key sequences are useful, for example, binding jk in vi insert mode to going to normal mode; you could as well have a little KEYTIMEOUT=20
    – Iacchus
    Jul 10, 2020 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.