indent 格式化C++代码的问题
生成一个文件~/.indent.pro, 比如内容为-nbad -bap -nbc -bbo -bl -bli0 -bls -ncdb -nce -cp1 -cs -ndj -nfc1 -nfca -hnl -i4 -ip5 -lp -npcs -nprs -psl -saf -sai -saw -nsc -nsob -cbi0 -cdw -cli4 -nbc -ppi2
以后就可以直接在命令行美化c/c++代码了。
$ indent example.cpp
但是对C++出现如下布局:
class T
{
public:
void F();
};
现在我有个问题,如何才能让c++的public/protected等不缩进,要达到如下效果:
class T
{
public:
void F();
};
请问要加个什么选项。 为什么对代码文件进行indent后,缩进的是两个空格,而不是一个table位? to yeale:
.indent.pro中的-i4是让代码缩进4个空格。这个配置文件中的内容对C代码以及C++代码都比较适用。唯独public等以及template的位置有点问题。
class T
{
public:
void F();
};
上面的void F();是相对“{”位置缩进了4个空格。问题在于public无缘无故地缩进了2格。不知道有没人知道怎么让public不缩进。 to yeale:
.indent.pro中的-i4是让代码缩进4个空格。这个配置文件中的内容对C代码以及C++代码都比较适用。唯独public等以及template的位置有点问题。
class T
{
public:
void F();
};
上面的void F();是相对“{”位置缩进了4个空格。问题在于public无缘无故地缩进了2格。不知道有没人知道怎么让public不缩进。
在我的机子上indent的时候,public:相对{没缩进,别的都是缩进两个空格位。我的系统怎么没有.indent.pro文件?
页:
[1]