How to bind <Control><Arrowkey> in Mutt?

I found the correct answer here: Bind ctrl+up in muttrc | mail-archive.com.

Inside mutt, use the command

:exec what-key

Then pressing the desired key (like Ctrl+arrow) you can learn how to reference any key. In my case I get <C-Up> for Ctrl+Up.

Hit Ctrl-g to exit what-key.


First, you need to determine whether your terminal sends different escape sequences for these key combinations. Applications running in terminals get characters as input, not keys. Function keys are encoded as control characters or as escape sequences beginning with the escape character (which you can write as \e in a key binding).

To see the escape sequence sent by a key combination in a terminal, press Ctrl+V at a shell prompt, then press the key combination. For example, if I press Ctrl+V Ctrl+Left at a shell prompt, I see ^[O5D. ^[ is the escape character, so I would need to bind \eO5D in Mutt to make it react to Ctrl+Left:

bind editor \eO5D backward-word

Some terminals send the same escape sequence for the same key with different modifiers. If that's the case, you'll need to figure out how to change the terminal's behavior or switch to a different terminal.

Tags:

Mutt