Thanks to the wiki for this. If you run across a file that mixes tabs and spaces (ewww!), set the tab settings the way you want (e.g., ts=4 sts=4 sw=4 et ai) and run
:retab
to convert all the tabs to the right number of spaces. This takes tab stops into account, which :%s/^I/ /g won’t.
This replaces what I used to do, which was /^I s<Tab><Esc> followed by a whole lot of n.n.n.n.n.n.n.n. … . One command is much better 🙂 . I’m not even going to try to count the keystroke savings on my current project (pym, a preprocessor written in Python).