I am using iTerm2 on OSX, and I am using an external keyboard with a Del (not to be confused with Backspace). The Del key works fine in OSX but in Terminal and iTerm, it inserts "~" instead of deleting forwards one character. This is easily fixable in Terminal, but in iTerm, there is no key binding or escape sequence that allows me to delete a character to the right of the cursor (the equivalent Unix command is Ctrl D). Is there any way I can simulate deleting forwards one character in iTerm?
The Delete and the Backspace keys are used for the simplest delete operations. They work fully naturally: The character under the cursor can be deleted by pressing the Delete key. This is a so called forward delete.
Mac OS X Terminal: Map option+delete to "backward delete word" New! Save questions or answers and organize your favorite content. Learn more.
How do I open iTerm2 on Mac? To open iTerm 2, you simply need to double-click its icon – the one that you downloaded. If you go through the process of setting up hotkeys for the app, you will also be able to open iTerm2 through a specified by you keyboard combination.
If you are using zsh, try adding these lines to your ~/.zshrc file, then close and reopen the terminal:
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
These should enable your delete key on any keyboard, without manual keyboard mappings to the hex command 0x04
, which has the problem that it closes the session if the input is empty.
Why this? Because it seems that zsh doesn't read /etc/inputrc with the key bindings by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With