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处的缩进(略)

 

          

 

转载于:https://www.cnblogs.com/feix760/archive/2012/06/02/2532266.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值