Enable soft tabs in Vim

If you want to enforce soft tabs (spaces instead of tabstops) in Vim put this into your ~/.vimrc (Linux) or C:\Users\<Username>\_vimrc (Windows):

set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab

You can also call those commands in a running Vim instance (using ":set ...") to switch on soft tabs temporarily.

On a side note: remember the :mkvimrc command Show archive.org snapshot that saves active settings to a vimrc file.

Arne Hartherz Almost 13 years ago