Saturday, August 22, 2009


Enabling options based on filetype in vim. Picked from here 


:au BufRead *.c so ~/.vim/c.vim
:au BufNewFile *.c so ~/.vim/c.vim
:au BufRead *.py so ~/.vim/py.vim
:au BufNewFile *.py so ~/.vim/py.vim

Then put this in ~/.vim/c.vim:

set shiftwidth=8 

And this in ~/.vim/py.vim:

set shiftwidth=8 

That'll cause vim to source the specified file when the corresponding file type is read (or when a new file of the corresponding type is created).