clion配置Astyle
下载插件file watchers

工具-file watchers,选择

添加配置项
名称:随便写 文件类型:C/C++ 作用域:打开文件 程序:Astyle解压路径 实参:-i -n $FileName$ --options=D:.astylerc(注:-n不备份,.astylerc文件内存在下面) 输出路径:$FileName$ 工作目录:$FileDir$ 高级选项前两个打勾

附.astylerc文件内容
#基本样式 --style=allman #默认缩进四个空格 --indent=spaces=4 #do-while 语句附加到右大括号 --attach-closing-while #开启所有switch-case的缩进 --indent-switches #开启命名空间的缩进 --indent-namespaces #开启左括号换行 --indent-after-parens #在左括号换行时的缩进个数 --indent-continuation=4 #开启预处理的缩进 --indent-preproc-block #开启预处理中,的对齐 --indent-preproc-define #设置在多行条件语句之前添加的最小缩进 --min-conditional-indent=0 #设置最大的空格数来缩进后续换行 --max-continuation-indent=60 #在条件语句和循环语句前后填充一行空格 --break-blocks #在操作符前后插入空格 --pad-oper #删除操作符中多余的空格 --unpad-paren #删除函数或方法中的多余空行 --delete-empty-lines #指针或应用名字对齐 --align-pointer=name #给单行的条件与循环语句加上大括号 --add-braces #将返回类型附加到函数名之前(定义) --attach-return-type #将返回类型附近到函数名之前(声明) --attach-return-type-decl #将制表符转换为非缩进部分的空格 --convert-tabs #一行代码的最大长度为120 --max-code-length=120
作者声明本文无利益相关,欢迎值友理性交流,和谐讨论~
