The delete key works - delete text to the right.

But the backspace key (I'm using an external keyboard btw) moves left but doesn't delete (I am in insert mode)

However it does work OK (moves the remaining text left AND removes one chr) at the command line itself when I use command line vi (set -o vi) and insert mode.

I normally use tmux and iterm2 however I experimented with the basic terminal app and the problem persists (I am still using tmux though in case that is the issue)

1 Answer 1


Is this a new keyboard? I wonder if it's outputting a slightly non-standard code for backspace, one that many programs accept, but vim does not. Try CTRL-H - that should work as backspace in vim.

You can find out the code your backspace key outputs by going to Terminal, then Preferences>Settings>Keyboard and double-clicking any key in the list. Make sure "Send Text:" appears in the dropdown next to "Action:" Press your backspace key and its code will appear in the box. Make sure to click cancel so you don't change a mapping here. (Mine reports \177 on an Apple keyboard.)

You'll then need to convince Vim to respond to that code. This tutorial looks like it will explain that process. http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-Tutorial(Part_1)

Of course, you could also look for a different keyboard.

References: http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-Tutorial(Part_1) http://hea-www.harvard.edu/~fine/Tech/vi.html

  • Interestingly ctrl-h moves the cursor left 1 chr but doesn't do the delete. Aug 24, 2015 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .