views:

343

answers:

19

Hello,

I am looking for a list of code formatting and prettifying software; I have only found a few topics that all are language specific.

This is not about syntax highlighting!

If possible, I prefer lightweight, command-line, multiplatform, portable tools.
Nevertheless, if there is no interesting alternative, I also like to know what is available which does not meet those conditions.

Freely available software, and more particularly open-source software are also preferred.

Examples:

Ada

C

C#

C++

COBOL

D

Delphi

EGL

FORTRAN

HTML

Java

JavaScript

Natural

.NET

ObjectiveC

Pawn

Perl

PHP

PLSQL

Python

SQL

Verilog

VHDL

Visual Basic

VALA

Thank you for your ideas.

+2  A: 

For Java there exists Open source IDE IntelliJ idea that can easily format code.
It's not lightweight and not command-line. But multi-platform and free.

http://www.jetbrains.com/idea/free_java_ide.html

It supports Java, HTML and many others languages.

Konoplianko
+6  A: 

A very old but functional one is indent, on Unix, for C

Pascal Cuoq
+1  A: 

Notepad++ is GUI rather than command-line, but it pretty-prints lots of languages.

smirkingman
Do you mean syntax highlighting or indenting and reformatting features?
Benoit
It does both. .
Jeff Cuscutis
I suppose in this case that pretty-printing and reformatting is done through plug-ins or TextFX… could you indicate what plug-ins you use for this?
Benoit
+2  A: 

JIndent (www.jindent.com) for Java and C/C++.

Jalopy (www.triemax.com) for Java.

Ralph
+1  A: 

NArrange - .NET Code Organizer/Formatter/Beautifier free, command line, supports mono too.

Giorgi
+1  A: 

uncrustify is a very powerful and configurable open source utility for C and C++. A good front end GUI is also available for it (and many others... hint hint) called UniversalIndentGUI.

The power comes in how many formatting attributes it can be configured to adjust. The downside is it takes a couple of days of studying the hundreds of parameters and getting just the right combination for your preferred formatting style.

Once you have that config file, though, it is like a pocket full of gold.

Here is my config file: http://www.aximel.com/files/uncrustify.cfg

Amardeep
+2  A: 

Perl has Perl::Tidy.

brian d foy
+1  A: 

Our company, Semantic Designs, offers language specific code formatters for a wide variety of languages, including C, C++, C#, COBOL, Java, PHP, Javascript, Python, Fortran, Ada, VisualBasic and many others.

We in fact have such formatters for for the set of languages listed here, although many of them are not currently packaged directly for use by themselves.

Ira Baxter
+1  A: 

I would like to add Tora that can reformat SQL (CTRL·SHIFT·ALT·I in editor window)

Benoit
+1  A: 

For Delphi:

Davy Landman
+1  A: 

ModelMaker for Delphi and C# is decent: http://www.modelmakertools.com/

kyndigs
+1  A: 

The JetBrains Resharper Visual Studio addin does a lot of stuff, including code formatting. It's not lightweight, and it's not command line.

Heini Høgnason
+2  A: 

Within jEdit I've used a bunch of plugins: AStyle, Beauty, CheckStyle, Jalopy and JavaStyle

bemace
+1  A: 

Definitely CTRL-K-D in Visual Studio to auto-format your code. This works with all code loaded in VS, including XML and ASPX file. I used this so much now that sometimes I unconsciously do that without thinking after editing aspx file.

Fadrian Sudaman
A: 
slomojo
I'd love to hear some constructive feedback along with that downvote.
slomojo
A: 

SQL in Form.

Dave Jarvis
+2  A: 

Gofmt is the official code formatter for Go code. It has been there since Go was first released and is (AFAIK) intended to make Go code consistent between applications and libraries.

Hannson
A: 

Vim has the = command for reformatting.

mouviciel
Benoit