开发者

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

开发者 https://www.devze.com 2023-01-16 14:57 出处:网络
Using the Uncrustify tool I would like to apply the 1TBS style, which places braces like this开发者_JAVA百科:

Using the Uncrustify tool I would like to apply the 1TBS style, which places braces like this开发者_JAVA百科:

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

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


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) {


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

0

精彩评论

暂无评论...
验证码 换一张
取 消