Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Is there an application that can easily align/format brackets such as [ ] { and } ?

e.g. change

{

{
     }
    }

into

{
  {
  }
}
share|improve this question

closed as off topic by Walter, Ryathal, GlenH7, MainMa, ChrisF Nov 10 '12 at 10:46

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Accolades? I'm unfamiliar with this term. –  Jimmy Hoffa Nov 9 '12 at 16:30
    
What IDE/editor are you using? Check to see if it has a "format code" command. –  FrustratedWithFormsDesigner Nov 9 '12 at 16:53
1  
What language are you using? People could probably suggest IDE's for that language which do auto format for you. –  Jimmy Hoffa Nov 9 '12 at 17:03
1  
Looking at your activity on StackOverflow, I suppose you need a tool for C#. I guess Resharper is a must-have tool for C# developing. Many people (like myself) can't imagine their lives without it. :) Try the free trial to see if this is what you need. –  bytebuster Nov 9 '12 at 17:49
3  
@bytebuster I don't think he needs ReSharper just for that, does he? I'm fairly certain Visual Studio has an auto format shortcut that defaults to the bracketing style he's looking for. Select some text and CTRL+K-F –  KChaloux Nov 9 '12 at 19:03
show 1 more comment

2 Answers

up vote 2 down vote accepted

There are plenty of source-code formatters available, both commercial and free.

Look at something like Artistic Style as an example; it's simple, it's free, it's multi-platform, it can be invoked from the command-line (or as a custom build step in your IDE) and it has good batch modes for operating on multiple source files using options stored in it's own config file.

share|improve this answer
add comment

Most popular IDEs have a "Format" option that will format a document to the layout configuration that you specify (or their default layout). Try looking at the documentation for your IDE to see if it has this option.

share|improve this answer
    
We use nedit and don't use a populairi IDE here :-( –  Michel Keijzers Nov 9 '12 at 17:16
4  
@MichelKeijzers Any reason you're using NEdit? A cursory glance online shows that it's a dead project that hasn't had significant development since 2004. It looks like it's for UNIX. Any reason you can't switch to something more powerful like Vim or Emacs? –  KChaloux Nov 9 '12 at 19:06
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.