

Do you know of a good solution to tab your code for you? - zack

Does anybody know of a good solution to auto-tab your code?
======
lacker
Tabbing your code is really something you want handled by your text editor.
What text editor are you using?

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.

~~~
zack
The problem I have is that I just wrote a bunch of shit in vi (which has _not_
been auto-indenting for me, though I should probably check my .vimrc or
whatever), and now I'm editing it using TextMate, and the formatting is all
screwed up.

~~~
apu
What language is your code in? If it's a curly-brace language (c, c++, java,
etc.), then the following should properly indent everything using Vim:

    
    
      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<

------
yan
'indent' in most unixes.

