Setting Vim whitespace preferences by filetype

there are many ways, but here’s a simple, easy to understand way. add these lines to your ~/.vimrc:

autocmd FileType html setlocal ts=2 sts=2 sw=2
autocmd FileType ruby setlocal ts=2 sts=2 sw=2
autocmd FileType javascript setlocal ts=4 sts=4 sw=4

Leave a Comment