Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .