--style=ansi -s4 --pad-oper -S -N -L -m0 --add-brackets -M40 --suffix=none --convert-tabs %{CurrentDocument:FilePath}html
--pad-oper就是操做符的兩邊都要加空格java
http://www.qtcn.org/bbs/read-htm-tid-52879.htmllinux
Astyle編程語言格式化工具的中文說明
Artistic Style 1.23
Maintained by: Jim Pattee
Original Author: Tal Davidson
Usage : astyle [options] Source1.cpp Source2.cpp [...]
astyle [options] < Original > Beautified
When indenting a specific file, the resulting indented file RETAINS the
original file-name. The original pre-indented file is renamed, with a
suffix of ".orig" added to the original filename.
Wildcards (* and ?) may be used in the filename.
A 'recursive' option can process directories recursively.
能夠用通配符指定要處理的文件,用-r遞歸處理子目錄
By default, astyle is set up to indent C/C++/C#/Java files, with 4 spaces
per indent, a maximal indentation of 40 spaces inside continuous statements,
and NO formatting.
Option's Format:
----------------
Long options (starting with '--') must be written one at a time.
Short options (starting with '-') may be appended together.
Thus, -bps4 is the same as -b -p -s4.
風格:
-------------------------
--style=allman OR --style=bsd OR -A1
allman風格
Allman style formatting/indenting.
Broken brackets.
--style=java OR -A2
java風格
Java style formatting/indenting.
Attached brackets.
--style=k&r OR --style=k/r OR -A3
k&r風格
Kernighan & Ritchie style formatting/indenting.
Linux brackets.
--style=stroustrup OR -A4
stroustrup風格
Stroustrup style formatting/indenting.
Stroustrup brackets.
--style=whitesmith OR -A5
whitesmith風格
Whitesmith style formatting/indenting.
Broken, indented brackets.
Indented class blocks and switch blocks.
--style=banner OR -A6
banner風格
Banner style formatting/indenting.
Attached, indented brackets.
Indented class blocks and switch blocks.
--style=gnu OR -A7
gnu風格
GNU style formatting/indenting.
Broken brackets, indented blocks, indent is 2 spaces.
--style=linux OR -A8
linux風格
GNU style formatting/indenting.
Linux brackets, indent is 8 spaces.
Tab and Bracket Options:
------------------------
tab選項:
默認tab是4個空格.
--indent=spaces=# OR -s#
默認行縮進爲4個空格,能夠將#替換爲縮進量
--indent=tab OR --indent=tab=# OR -t OR -t#
行縮進用tab,默認tab長度與4個空格相等
--indent=force-tab=# OR -T#
優先採用空格縮進
大括號選項:
If no brackets option is set,
the brackets will not be changed.
--brackets=break OR -b
大括號與前一塊隔開爲兩行
Break brackets from pre-block code (i.e. ANSI C/C++ style).
--brackets=attach OR -a
大括號前一個與上一行在同一行
Attach brackets to pre-block code (i.e. Java/K&R style).
--brackets=linux OR -l
定義塊 和 函數塊中的大括號都被處理
Break definition-block brackets and attach command-block
brackets.
--brackets=stroustrup OR -u
只處理函數中的大括號
Attach all brackets except function definition brackets.
Indentation options:
--------------------
--indent-classes OR -C
縮進類定義中的public private protected標籤.
Indent 'class' blocks, so that the inner 'public:',
'protected:' and 'private: headers are indented in
relation to the class block.
--indent-switches OR -S
縮進switch中的case塊,case和switch不在同一列
Indent 'switch' blocks, so that the inner 'case XXX:'
headers are indented in relation to the switch block.
--indent-cases OR -K
縮進case下面的語句
Indent case blocks from the 'case XXX:' headers.
Case statements not enclosed in blocks are NOT indented.
--indent-blocks OR -G
給塊添加縮進,包括大括號
Add extra indentation entire blocks (including brackets).
--indent-brackets OR -B
給大括號添加縮進
Add extra indentation to '{' and '}' block brackets.
--indent-namespaces OR -N
縮進命名空間定義行
Indent the contents of namespace blocks.
--indent-labels OR -L
標籤縮進
Indent labels so that they appear one indent less than
the current indentation level, rather than being
flushed completely to the left (which is the default).
--indent-preprocessor OR -w
多行宏定義縮進
Indent multi-line #define statements.
--max-instatement-indent=# OR -M#
跨行縮進,好比函數定義中的參數處在多行,那麼參數縮進到同一列
Indent a maximal # spaces in a continuous statement,
relative to the previous line.
--min-conditional-indent=# OR -m#
Indent a minimal # spaces in a continuous conditional
belonging to a conditional header.
Formatting options:
-------------------
--break-blocks OR -f
空行分隔沒有關係的塊,類,標籤(不包括函數塊)
Insert empty lines around unrelated blocks, labels, classes, ...
--break-blocks=all OR -F
空行分隔無關係的塊,包括else catch等
Like --break-blocks, except also insert empty lines
around closing headers (e.g. 'else', 'catch', ...).
--break-closing-brackets OR -y
else catch左邊的大括號與else catch分隔
Break brackets before closing headers (e.g. 'else', 'catch', ...).
Use with --brackets=attach, --brackets=linux,
or --brackets=stroustrup.
--break-elseifs OR -e
else if()分隔爲兩行
Break 'else if()' statements into two different lines.
--delete-empty-lines OR -x
刪除多餘空行
Delete empty lines within a function or method.
It will NOT delete lines added by the break-blocks options.
--pad-oper OR -p
操做符兩端插入一個空格
Insert space paddings around operators.
--pad-paren OR -P
括號內外都插入空格
Insert space padding around parenthesis on both the outside
and the inside.
--pad-paren-out OR -d
括號外部插入空格
Insert space padding around parenthesis on the outside only.
--pad-paren-in OR -D
括號外部插入空格
Insert space padding around parenthesis on the inside only.
--unpad-paren OR -U
移除括號兩端多餘空格
Remove unnecessary space padding around parenthesis. This
can be used in combination with the 'pad' options above.
--keep-one-line-statements OR -o
一行中的多個申明不分隔 int x;int y;int z不被分爲3行
Don't break lines containing multiple statements into
multiple single-statement lines.
--keep-one-line-blocks OR -O
大括號中的單行語句不被拆分
Don't break blocks residing completely on one line.
--convert-tabs OR -c
tab轉換爲空格
Convert tabs to the appropriate number of spaces.
--fill-empty-lines OR -E
塊間空行的換行符前插入一個空格
Fill empty lines with the white space of their
previous lines.
--mode=c
處理c文件
Indent a C or C++ source file (this is the default).
--mode=java
處理jave文件
Indent a Java source file.
--mode=cs
處理c#文件
Indent a C# source file.
Other options:
--------------
--suffix=####
指定備份文件的後綴
Append the suffix #### instead of '.orig' to original filename.
--suffix=none OR -n
不備份文件
Do not retain a backup of the original file.
--options=####
指定從####文件讀取選項信息
Specify an options file #### to read and use.
--options=none
禁止從文件讀取選項信息
Disable the default options file.
Only the command-line parameters will be used.
--recursive OR -r OR -R
遞歸處理子目錄
Process subdirectories recursively.
--exclude=####
排除不處理的文件夾
Specify a file or directory #### to be excluded from processing.
--errors-to-stdout OR -X
Print errors and help information to standard-output rather than
to standard-error.
--preserve-date OR -Z
不修改時間
The date and time modified will not be changed in the formatted file.
--verbose OR -v
輸出詳細處理信息
Verbose mode. Extra informational messages will be displayed.
--formatted OR -Q
輸出信息中只包括被修改的文件信息
Formatted display mode. Display only the files that have been formatted.
--quiet OR -q
忽略全部錯誤
Quiet mode. Suppress all output except error messages.
--version OR -V
輸出astyle版本
Print version number.
--help OR -h OR -?
幫助信息
Print this help message.
Default options file:
---------------------
Artistic Style looks for a default options file in the
following order:
1. The contents of the ARTISTIC_STYLE_OPTIONS environment
variable if it exists.
從ARTISTIC_STYLE_OPTIONS環境變量讀取選項
2. The file called .astylerc in the directory pointed to by the
HOME environment variable ( i.e. $HOME/.astylerc ).
從/home文件夾中的.astylerc文件讀取選項
3. The file called astylerc in the directory pointed to by the
USERPROFILE environment variable ( i.e. %USERPROFILE%\astylerc ).
從USERPROFILE下的astylerc文件讀取選項信息
If a default options file is found, the options in this file
will be parsed BEFORE the command-line options.
Long options within the default option file may be written without
the preliminary '--'.編程
--options的用法:
個人在source insight中的設置爲 AStyle.exe --options=D:\TOOLS\AStyle\astyle.cfg %f
astyle.cfg內容爲:
-s4 -SKFxpUcnlaCc#