converting tabs to spaces in vi

Nov 06, 2008 Mac OS X Python

This is mostly for my own personal reference - just one of those little things I use frequently and always forget how to set up:

If you're writing Python, then you know that indentation is, uhm, somewhat important. Mkay. I use four space indentation as a standard, but it's kind of a pain with vim, and my space bar is wearing out (one more reason to keep things nice and DRY though).

Anyway, to save myself a few keystrokes and a lot of aggravation, I just added a line to my vimrc:

sudo vi /usr/share/vim/vimrc
set softtabstop=4
Now hitting the tab key inside any file will indent four spaces. Simple but useful.