c++ - 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:

    // 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.


1 Answer

  1. Elliott- Reply


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

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>