uncrustify是一个代码格式化工具,支持mac win linux平台,可单独使用,也可被第三方工具(如Source insight,Atom)调用。本文讨论MAC下的安装配置方法。
1、安装
使用homebrew安装,命令:brew install uncrustify
2、使用方法
uncrustify -h 命令可以查看使用方法,
uncrustify --show-config 命令可以列出所有配置项和配置说明
3、Atom配置方法
安装atom uncrustify插件;
在~/
下新建 .uncrustify
目录,将配置文件(官网有默认配置文件)放到下面,改名为例如uncrustify.cfg
(详细见官网 http://uncrustify.sourceforge.net ) ,然后在atom的atom-beautify包设置里面指定uncrustify.cfg
路径。
Note: Use comments containing ' *INDENT-OFF*' and ' *INDENT-ON*' to disable
processing of parts of the source file (these can be overridden with
enable_processing_cmt and disable_processing_cmt).