Jim Blackler
Jim Blackler

Reputation: 23169

How do I force opening braces to share the previous code line?

Using the Uncrustify tool I would like to apply the 1TBS style, which places braces like this:

if (x < 0) {
    printf("Negative");
}

How do I do this? I can't seem to find the right options.

Upvotes: 5

Views: 1254

Answers (2)

Scott McCoy
Scott McCoy

Reputation: 308

There's a tool called UniversalIndentGui that lets you play with Uncrustify's various tersely-worded settings and see immediate impact on a block of sample code.

Screenshots of UniversalIndentGUI

Upvotes: 0

phi
phi

Reputation: 10733

I think you need to set nl_if_brace to ignore/add/remove/force.

Also, check the sp_else_brace and sp_brace_else options. Set it to 1, otherwise your code will end up with code such as:

if (condition){

instead of

if (condition) {

Upvotes: 4

Related Questions