Use the zsh widget, describe-key-briefly, to show the binding (definition) of any key or key combo.

Using describe-key-briefly

By default, describe-key-briefly is bound to optx.

Press optx and a new line will appear below the active command line:

execute: _

Enter “describe” and press TAB to autocomplete the command, which should expand to describe-key-briefly. Press enter to run the command and the line changes to:

Describe key briefly: _

Then press a key (or key combination) to see what, if anything, it’s bound to. I entered optctrlk above to verify it wasn’t in use. The line changed to:

"^[^K" is undefined-key

Add a key binding

Since I found myself using this widget often while exploring key bindings, I added a binding for optctrlk to call describe-key-briefly directly:

bindkey "^[^K" describe-key-briefly

To verify, press optctrlk twice. You should see:

"^[^K" is describe-key-briefly

Categories:

Published: