Source Insight 格式化

1、Artistic Style 下载地址:http://sourceforge.net/project/showfiles.php?group_id=2319l

2、在Source Insight挂载AStyle

2.1解压到某个目录(记住路径,如D:\AStyle\)

2.2SourceInsight -> Options -> Custom Commands -> Add 在弹出的对话框中写入命令名(最终会出现在View下面)

2.3在Run中添加相应命令:D:\AStyle\bin\AStyle.exe --style=ansi -s4 -S -N -L -m0 -M40 --convert-tabs --suffix=.pre %f

即,ansi C 格式化当前文件!

如果要格式化某个目录下所有文件:

在Run中添加命令为:D:\AStyle\bin\AStyle.exe Z:\Android/*.c Z:Android/*.h --style=ansi -s4 -S -N -L -m0 -M40 --recursive --convert-tabs --suffix=.pre %f

2.4Dir留空,将Iconic Window, Capture Output, Parse Links in OutPut, File,then Line 四项前打上勾。

2.5然后点对话框中右侧的按钮“Menu”, Menu--->Menu-->View--><end of menu>, 右侧Insert, OK.

2.6此时在SourceInsight中的View菜单下多了个Style的子菜单选项,可以用它来对单个C/C++文件进行格式化。

参考:

http://blog.csdn.net/lb015331/article/details/6817599

http://blog.csdn.net/rishihk/article/details/2297093

原文地址:https://www.cnblogs.com/jimwind/p/3067724.html