Source Insight的代码格式化配置和使用(动画演示工具-Astyle)
目录
1.Astyle工具
Astyle是一个免费的代码格式化工具,能够格式C/C++/Java等代码。
下载地址为:https://sourceforge.net/projects/astyle/
工具主页为:http://astyle.sourceforge.net/
2.Astyle工具配置
- 将下载后的AStyle_3.0.1_windows放在Source Insight安装目录下并解压。
- 在Source Insight 的菜单栏中,选择 tools->Custom Commands
如下图:点击add输入命令名字:astyle(随便起)
3.配置路径和参数
run: D:\tools\AStyle_3.1_windows\AStyle\bin\AStyle.exe astyle *.c *.cpp *.h --recursive --style=bsd --convert-tabs --indent=spaces=4 --attach-closing-while --indent-switches --indent-namespaces --indent-continuation=4 --indent-preproc-block --indent-preproc-define --indent-preproc-cond --indent-col1-comments --pad-oper --pad-paren-in --unpad-paren --delete-empty-lines --align-pointer=name --align-reference=name --break-elseifs --add-braces
或者:
run:D:\tools\AStyle_3.1_windows\AStyle\bin\AStyle.exe --style=ansi -s8 -S -N -L -m0 -M40 --convert-tabs --suffix=.pre %f
4:添加快捷键
点击下图中的keys
点击下图中的Assign New key 后再键盘输入快捷键 例如ctrl + alt +p
5.添加菜单按钮
点击下方红框里的menu
选择menu的work菜单栏 点击astyle insert由灰变黑,点击插入即可
3.格式化参数含义
https://blog.****.net/wisepragma/article/details/80993437
4.演示效果动画