smoothware
smoothware

Reputation: 948

CodeBlocks: Change the style of { } completion

I am currently using CodeBlocks as my C++ IDE. If I am coding in "Allman Style", by which I mean this:

foo()
{
    // cursor goes here
}

the brace completion is very satisfactory. Upon typing the opening {, it immediately completes the closing } and sets the cursor between them, with correct indentation level.

However, if I want to code in this other style, which looks like this:

foo() {
    // code goes here
}

The brace completion is almost annoying for me. After typing the opening {, only after pressing Return does it complete the closing }. Besides, what I end up with is this:

foo() {
|}

whereas '|' is the cursor. As you can see, the closing brace is still on the same line. Additionally, the indentation level isn't correct. I would like CodeBlocks to give me the following result upon typing the opening {

foo() {
    |
}

Whereas '|' represents the cursor position.

For the life of me I can't figure out which setting I need for this. I am pretty sure it's possible, since it works so nicely for the first style.

I hope that I explained my problem precise enough and that someone can help me out with this.

Smoothware

Upvotes: 4

Views: 1688

Answers (1)

rsarov
rsarov

Reputation: 79

Code::Blocks version 17.12 Settings->Editor->Source formatter-> select Bracket style Google or Mozilla Use AStyle from context menu for formatting any file

Upvotes: 3

Related Questions