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?

link|improve this question
feedback

3 Answers

This seems to work:

imap <BS> <Left><Del>

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

set whichwrap+=[
link|improve this answer
feedback

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

link|improve this answer
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.