我可以更改Code :: Blocks自动缩进的行为吗? [英] Can I change the behavior of Code::Blocks auto-indent?
问题描述
我曾经使用Microsoft Visual Studio 2005编写C ++代码,并且在其中自动缩进的行为非常好.
I used to use Microsoft Visual Studio 2005 to write C++ code, and the behavior of auto-indent in it was very good.
但是当我尝试使用Code :: Blocks时,我意识到其中的auto-indent行为很糟糕.
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
if
和while
有没有办法改变Code :: Blocks中自动缩进的行为,使其与Microsoft Visual Studio自动缩进一样好?
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?
推荐答案
首先,确保已启用smart indent
(设置->编辑器->智能缩进).
First, make sure smart indent
is enabled (Settings -> Editor -> Smart indent).
在Ubuntu上仍然无法使用,但是使用
It still wasn't working for me on Ubuntu, but installing the codeblocks-contrib
package with
sudo apt-get install codeblocks-contrib
修复了一些问题.它修复了if
,while
,for
的智能缩进,但不适用于类和函数.如果有人知道如何解决其余问题,请告诉我.
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.
这篇关于我可以更改Code :: Blocks自动缩进的行为吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!