ZSH Keybindings
03:28 04 May 2024

I have created custom a function, and I want to map it to a keybinding, so it is executed upon keypress.

Let's say the function is:

cdup() {
    cd ..
}

It's my understanding, that I should first create it as a widget. Let's do that:

$ zle -N cdup

A quick lookup in the widgets list, confirms, that it is in fact a widget:

$ zle -l | grep cdup
autosuggest-orig-1-cdup (cdup)
cdup (_zsh_autosuggest_bound_1_cdup)

I should now be able to bind it to a key ('ctrl + down arrow') with:

$ bindkey "^[1;5B" cdup

Pressing 'ctrl + down arrow' however does nothing. Not an error, just plain nothing. What could I be doing wrong?

zsh zsh-zle