25

In zsh, whenever I press Fn+Delete (which is forward delete) a tilde (~) gets inserted. This indicates zsh doesn't have the key bound.

How do I bind it, and make it behave normally (delete in front of the cursor)?

Chealion
  • 26,327
Thomas R
  • 453

3 Answers3

24

First figure out what sequence it generates.

echo "CtrlVFnDelete" | od -c

Then bind that sequence using the normal zsh bind mechanism.

5

For me the above didn't do the trick so I added the following key binding to my ~/.zshrc:

bindkey "\e[3~" delete-char

FYI: I am on a Mac (High Sierra).

2

bindkey 'CtrlvFnDelete' delete-char

This will bind Fn+Delete to delete forward a single character. If the above is not clear, you need to type Ctrl+v, Fn+Delete between typing the quotes. Ctrl+v allows you type the literal escape escape sequence of whatever key comes after it.

You can put this line in your ~/.zshrc file.