Tabs… Don't you hate tabs?

Tabs… Don’t you hate tabs? I mean, the idea is nice, saving bytes and stuff. But the world isn’t ready for them yet.

Here’s our Xcode indentation settings:

And here are two lines of shell script that will help you clean up your already messed up code base :)

find ./ -iname '*.[hcm]' -type f -exec gsed -i 's/\t/    /g' {} \;
find ./ -iname '*.[hcm]' -type f -exec gsed -i '/^[ \t]*$/! { s/[ \t]*$//g }' {} \;

What they’ll do is, 1st of all replacing all existing tabs by four spaces. The second command takes care of trailing whitespace (but not in lines that only contain whitespace), because we also hate that! :-D

All that require the GNU version of sed. OSX ships with the BSD version, so you need to install it via

brew install gnu-sed