Vim and Python

While I remember, on the topic of doing stuff from the console, Vim rules. In its default configuration, Vim doesn’t play too well with common Python guidelines (as defined in PEP8) - the use of 4 spaces instead of tabs, for instance.

Popping this small hack in your ~/.vimrc makes Vim play nicer with Python:

autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class ts=4 sw=4 sta et sts=4 ai

These options were stolen off this site.

Update - since I originally posted this, I’ve found more Vim/Python tweaks, listed here.

Posted: 04 Aug, 2008
Tags:
blog comments powered by Disqus