I'd prefer one line it and use the "long" names and add nocompatible set nocompatible hlsearch incsearch ignorecase number then sane tabs set et sts=4 sw=4
set expandtab
set shiftwidth=4
set softtabstop=4
function Spaces(...)
if a:0 == 1
let l:width = a:1
else
let l:width = 4
endif
setlocal expandtab
let &l:shiftwidth = l:width
let &l:softtabstop = l:width
endfunction
command! T setlocal noexpandtab shiftwidth=8 softtabstop=0
command! -nargs=? S call Spaces()
autocmd BufNewFile,BufRead ~/src/linux/* T
autocmd BufNewFile,BufRead ~/src/git/* T
autocmd FileType html S 2
autocmd FileType tex S 2
This sets the default to 4-space indents, but lets me do :T to switch to tabs (and does so automatically for Linux and Git which use that style), or :S N to switch to N-space indents (and automatically switches HTML and TeX to 2-space indents).