Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

one pretty printer "to rule them all"

I'm looking for a tool that can pretty-print (AKA tidy or beautify) source code in as many languages as possible. Those I'm particularly keen on include:

  • Java
  • JSP
  • HTML
  • JavaScript
  • SQL
  • JSON
  • XML

Ideally, the tool should be able to update source files in-place and be able to format more than a single file at-a-time. It would be great if it could format files containing multiple languages (e.g. a JSP containing HTML, Java, and JavaScript source code), but that's probably asking for a bit much.

I've already found a commercial tool that seems to cover a lot of languages, but a free one would be even better :)

BTW, I know there is a pretty printer available for most languages, but what I'm looking for is a "one-stop shop".

Cheers, Don

like image 243
Dónal Avatar asked Oct 30 '08 20:10

Dónal


1 Answers

I use Vim to do this all the time. It doesn't handle HTML very well, but it does the others. It's easy to use the Vim commands to automate running it on a number of files.

like image 100
rmeador Avatar answered Sep 19 '22 00:09

rmeador