Skip to content

Instantly share code, notes, and snippets.

@Akagi201
Created October 29, 2012 09:04
Show Gist options
  • Save Akagi201/3972500 to your computer and use it in GitHub Desktop.
Save Akagi201/3972500 to your computer and use it in GitHub Desktop.
Akagi201's AStyle configuration file
###############################################################################
# @file c.opt
# @note HangZhou Hikvision Digital Technology Co., Ltd. All Right Reserved.
# @brief AStyle configuration file stay in the same folder with AStyle
#
# @author liuboyf1
# @date 2012-10-29
# @version V1.0.0
# @note History:
# @note <author> <time> <version> <desc>
# @note liuboyf1 2012-10-29 V1.0.0 创建文件
###########################################################################
######################### mode and style ##############################
# 指定文件处理模式,C/C++模式,其他选择还有cs,java
mode=c
# ANSI标准的文件格式,就是{另启一行,}另启一行的那种,其他选择很多,不介绍了
style=ansi
######################### indent options ##############################
# 缩进采用4个空格
indent=spaces=4
# 将preprocessor (#define) 这类预定的语句,如果有多行时前面填充对齐,(是对单语句(多行)进行填充呀)
indent-preprocessor
######################### brackets #####################################
# 对于单行的语句增加括号
# Add brackets to unbracketed one line conditional statements (e.g. 'if', 'for', 'while'...)
add-brackets
# *,&这类字符靠近变量名字
# Attach a pointer or reference operator (* or &) to either the variable type (left) or variable name (right), or place it between the type and name.
align-pointer=name
# 在操作符号两边增加空格字符 ==
pad-oper
# 在几个关键字后面增加空格
# insert space padding after paren headers only (e.g. 'if', 'for', 'while'...)
pad-header
# 在if,for,while等代码段前后增加空行
# insert space padding after paren headers only (e.g. 'if', 'for', 'while'...)
break-blocks
# 备份文件的后缀,默认是.orig,=none表示不进行备份
suffix=none
# 行结束用什么文件格式, linux or windows
lineend=linux
# switch case的代码也按照标准缩进方式缩进
indent-switches
# 如果函数开始后面({后面)第一行是注释,也进行缩进
indent-col1-comments
@Akagi201
Copy link
Author

第一个版本还比较粗略,只是能运行而已,更详细的配置需要官网的阅读手册才行,http://astyle.sourceforge.net/astyle.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment