Search code examples
linuxunixvimvi

Backspace behaviour in Vim


I've got a problem with backspaces in Vim. If I hit backspace, the last character gets removed. I'd like to get the Vi (not Vim) behaviour. In Vi backspace moves the cursor to the left, and if I type in something, the characters I backspaced get replaced.

I tried

:imap <BS> <Left>

It works in GVim (even if the backspaced chars don't get replaced), but it does not work in Vim. If this helps, I use the standard XTerm as my terminal emulator, and my $TERM environment variable is set to 'xterm'.


Solution

  • I believe you want Replace instead of Insert mode. Hitting the 'insert' key once will put you into Insert mode but hitting it twice will put you into Replace mode. That should give you the expected behaviour.