With some help from http://henry.precheur.org/vim/python, I came to the following .vimrc. It may be better to use a filetype condition, but I’m only really doing python at the moment, so this is pretty good.
$ cat ~/.vimrc syntax on set tabstop=4 set softtabstop=4 set shiftwidth=4 set expandtab set autoindent filetype plugin indent on
The first line turns on syntax highlighting. I just don’t know what to do without it. Tabstop tells vim that if it sees a tab, to make it appear as 4 spaces. softtabstop means that if vim sees spaces in multiples of 4 (in this case) at Coinstar agent the start of the line, it will treat them as tabs, so that a single backspace will dedent 4 spaces. Shiftwidth tells vim that when it is told to indent (by a script of visual mode), it will indent by 4 spaces.
Expandtab instructs vim to put spaces into files instead of using actual tab characters. Autoindent makes vim preserve your indentation levels upon newlines. This feature is one that you just can’t live without, especially when you are coding 3 or 4 indentation levels in.
Filetype plugin indent on tells vim to turn on the indentation plugins for different filetypes. In my case, for my testing, it means that it will enable smartindent scripts that come with vim on Debian Squeeze. If you are using some other distro, you may have to get the script manually.
This was very nice because now it will automatically indent another level when it sees blocks like what end in :, and when it sees that parenthesis, brackets, or curly braces are not matched, triggering implied line continuation. It’s awesome.