Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change the behavior of Code::Blocks auto-indent?

I used to use Microsoft Visual Studio 2005 to write C++ code, and the behavior of auto-indent in it was very good.

But when I tried to use Code::Blocks, I realized that the behavior of auto-indent in it is awful.

for example one of the things that bother me:

for (int i = 0; i < n; i++)
//it start from here in Code::Blocks

for (int i = 0; i < n; i++)
    //I want it to start from here like in Visual Studio

the same thing for if and while

Is there any way to change the behavior of auto-indent in Code::Blocks so it'll be as good as Microsoft Visual Studio auto-indent?

like image 610
Gaith Avatar asked Dec 27 '22 10:12

Gaith


1 Answers

First, make sure smart indent is enabled (Settings -> Editor -> Smart indent).

It still wasn't working for me on Ubuntu, but installing the codeblocks-contrib package with

sudo apt-get install codeblocks-contrib

fixed some of the problems. It fixed the smart-indenting for if, while, for, but not for classes and functions. If anyone knows how to fix the rest of problem, please let me know.

like image 96
Garrett Avatar answered Jan 09 '23 10:01

Garrett