mghis
mghis

Reputation: 527

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'.

Upvotes: 1

Views: 592

Answers (2)

Friedrich
Friedrich

Reputation: 4647

To change only backspace to vi-compatible behavior, one would add v to cpoptions like this

:set cpoptions+=v

This is documented in :help 'cpoptions'.

I realize this is a very late answer but the feature seems to have been available since at least Vim 7 i.e. when the question was first asked.

Upvotes: 0

IanWhalen
IanWhalen

Reputation: 821

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.

Upvotes: 3

Related Questions