Daily Archives: May 7, 2007

Vim settings for whitespace

Indentation and whitespace alone can spawn whole religious wars with programmers. Some programs however have specific requirements or very strong ‘recomendations’ when it comes to tabs and whitespace so you may need to deal with both tabs and spaces for tabs.

Makefiles require tab characters as part of their syntax. Python strongly recommends you use spaces instead of tabs. In order to make sure that vim does the right thing when you edit these files you can add these commands to you .vimrc file,

autocmd FileType make set noexpandtab shiftwidth=8
autocmd FileType python set expandtab

This is in addition to your standard settings like autoindent,

set autoindent
set tabstop=4
set shiftwidth=4
set softtabstop=4

Follow

Get every new post delivered to your Inbox.

Join 64 other followers