code blocks 格式化代码设置 source formatter


  经常使用codeblock格式化代码,但默认的情况下,运算符号前后不会添加空格,比如a=23,不会格式化成a = 23,因此有必要花一段时间来研究研究如何设置了。

  codeblock 版本 10.05

  格式化代码的设置在:Settings-->>Editor..-->>source formatter

  有三个选项卡,Style,Indentation,Formatting。Style处选择一种预定义好了的样式,如果不为Custom(自定义)则Indentation和Formatting处都将不可设置,Formatting处设置大部分的东西,Indentation处设置如何缩进

  Style处选择Custom,然后Formatting里重要的设置如下:

    bracket format mode : 大括号{}的形式,

          如果选break,将为 if()

                    {

                    }

          如果选attach,将为if(){

                    }

          none为不改变原有样式,还有其它的两个(略)

    pointer alignment :指针*号的位置  int  *  a;    or   int*  a;    or    int  *a;   or 不改变原有样式

    pad empty lines around header blocks : if等语句前后都添加一空行  int a;+换行+ if(1)a=23;+换行+int b;    or     int a;+换行+换行+if(1)a=23;+换行+换行+int b;

    break 'else if()' header combinations into seperate lines : if()g(); or if()+换行+ g();

    insert space padding around operatiors: '=' 等运算符前后都加1空格

    insert space padding around parenthesies on the outside 括号外跟1空格

            ......................................................on the inside  括号内跟1空格

            remove extra space padding around parenthesis :  移除括号旁边其余的空格

            don't break complex statements and multiple statement... : 允许多条语句同行。int a;int b;     or    int a;+换行+int b;

 

     至于Indentation处的缩进(略)

 

          

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM