VIm, Spaces And Tabs

It might seem strange, but somehow my .vimrc file wasn’t version controlled so when I wiped my machine, I had to dig up the settings one can/should use for making tabs become spaces, 4 spaces. So here it is:

" size of a hard tabstop
set tabstop=4

" size of an "indent"
set shiftwidth=4

" a combination of spaces and tabs are used to simulate tab stops at a width other than the (hard)tabstop
set softtabstop=4

" make "tab" insert indents instead of tabs at the beginning of a line
set smarttab

" always uses spaces instead of tab characters
set expandtab

Once set :retab is a good command to “fix it”. :-)

This work by Fredrik Wendt is licensed under CC by-sa.