views:

38

answers:

3

I am working on a C assignment for uni, and I've been coding in TextMate and compiling in the command line.

But TextMate wont (or cant) format C code, as it would for say, HTML, Ruby or PHP (using SHIFT + CTRL + F).

Is there a plugin or some other tool I can use to fix my indenting and curly braces for .c files?

A: 

indent is a command-line tool that will properly indent your C code. It is highly customizable but its basic usage is indent <input.c> <output.c>. See man indent for options. Installed by default with Mac OS X Developer Tools, which I assume you have installed because you are writing C on a Mac.

greg
+1  A: 

I use astyle. It has a lot of options to customize according to your coding style, and I think it is included in the major linux distributions.

Jens Gustedt
+1  A: 

Try using Eclipse for C/C++ Developers. If has a formatting functionality. You can also compile and test within the IDE by just clicking a button. With Helios, the most current Eclipse release, there are more features.

Enjoy.

Yasky
Thats cool. you know the funny thing is I am a NetBeans developer - and I love it. It turns out NetBeans can do the formatting, so you gave me an idea - but i copied and paste to and fro to get the formatting I liked. Problem solved.But the interesting thing is that the more development I do on my Mac, the more I seem to be pushed towards Eclipse. Is it really THAT good?
Ash