Take the 2-minute tour ×

I have the following in my vimrc:

set tabstop=8
set shiftwidth=4
set softtabstop=4
set expandtab

set backspace=indent,eol,start

set autoindent

This does what I want: insert spaces only, never tab characters; pressing tab inserts 4 spaces; automatic indents are 4 spacces.

If I'm indented n levels and hit backspace in insert mode I go back 1 indent level (1 sts) to level n-1.

How can I configure the backspace key to take me back a single space instead?

share|improve this question

3 Answers 3

Removing "set softtabstop=4" will also give you the backspace behavior you want, although it may break other behaviors you're used to.

share|improve this answer

This seems to work:

imap <BS> <Left><Del>

Update: That makes backspace behave oddly at the left margin. This fixes that problem:

set whichwrap+=[
share|improve this answer

You could use

set tabstop=4 shiftwidth=4 expandtab

and delete

set softtabstop=4

and forget about tabs.

In my experience, tabs used to structure text sooner or later become a nuisance.

share|improve this answer

Your Answer


