source insight添加astyle

最近在source insight上看公司的源码,发现格式混乱不堪,于是发现了Astyle这个宝贝,这里分享一下安装经验:

1.从 http://astyle.sourceforge.net/ 上下载astyle.exe

2.将下载的astyle.exe放到磁盘(位置不限),我放在E:\si4.0下。
source insight添加astyle
3.在菜单栏的Tools->Custom Commands界面上点击Add起一个名字,我这里就叫Astyle。
source insight添加astyle
4.在run对话框里添加"E:\si4.0\AStyle.exe" --style=ansi %f,其中,参数–style=ansi(如果你需要格式化java代码,这个地方改为:–style=java),其它命令参数可以参考astyle的帮助参数,"%f"是指作用于当前文件,这个必须的.
source insight添加astyle
然后可以点击keys选择一键格式化,比如我是F10键
source insight添加astyle
5.也可以选择将Astyle加在菜单栏里,Options–>Menu Assignments界面上,插到任一选项的子选项里。
source insight添加astyle

以上。