Do you know of a good solution to tab your code for you?
Does anybody know of a good solution to auto-tab your code?
Most emacs modes do this automatically. For languages with braces like C++, Perl, or Ruby you just hit tab on any line, and it automatically indents it correctly. For languages like Python tab will cycle through the possible acceptable indentations.
Other text editors like Eclipse (and I believe vi) will indent correctly by default when you hit enter, but after that nothing is automatic. But that's pretty good too.
gg=G
If not (or if that doesn't work right), you can use visual mode to quickly change indents on large sections at once:Select a set of lines using:
V
and then press (for example): 2>
to add 2 tabs to the beginning of the selected lines.Or to go the other way (remove 2 tabs):
2<