Backspace key not working in Vim/vi

To allow backspacing over everything in insert mode (including automatically inserted indentation, line breaks and start of insert) you can set the backspace option:

:set backspace=indent,eol,start

or

:set backspace=2  "compatible with version 5.4 and earlier

By default this option is empty, not allowing you to backspace over the above-mentioned things. This is the standard Vi behavior.

You can put this line to your vimrc file to have it set automatically when Vim starts:

set backspace=indent,eol,start  " more powerful backspacing

Also, starting from Vim 8.0 if no user vimrc file is found, Vim will set backspace to this value by loading the defaults.vim script.

Leave a Comment