1、先看下注释生成的效果:
- /*****************************************************************************
- * @COPYRIGHT NOTICE
- * @Copyright (c) 2013, ChenMH
- * @All rights reserved
- * @file : TestHead.h
- * @version : ver 1.0
- * @author : ChenMH
- * @date : 2013/5/17 14:56
- * @brief :
- *****************************************************************************/
/*****************************************************************************
* @COPYRIGHT NOTICE
* @Copyright (c) 2013, ChenMH
* @All rights reserved
* @file : TestHead.h
* @version : ver 1.0
* @author : ChenMH
* @date : 2013/5/17 14:56
* @brief :
*****************************************************************************/
2、再来说下使用方法:
1)、 在主菜单中,依次选择【VAssistX->Visual AssistX Options->Advanced->Suggestions】,单击右边的Edit VA Snippets,即可进入编辑。
2)、选中"c++"->右键->new。即可建立自定义的宏。
3)、用的时候,在编辑器中输入你定议的Shortcut即可弹出注释补全框。如我的Shortcut是cmh。
如下图:
下面是我用到的宏:
- /*****************************************************************************
- * @COPYRIGHT NOTICE
- * @Copyright (c) 2013, ChenMH
- * @All rights reserved
- * @file : $FILE_BASE$.$FILE_EXT$
- * @version : ver 1.0
- * @author : ChenMH
- * @date : $YEAR$/$MONTH$/$DAY$ $HOUR$:$MINUTE$
- * @brief : $brief$
- *****************************************************************************/
/*****************************************************************************
* @COPYRIGHT NOTICE
* @Copyright (c) 2013, ChenMH
* @All rights reserved
* @file : $FILE_BASE$.$FILE_EXT$
* @version : ver 1.0
* @author : ChenMH
* @date : $YEAR$/$MONTH$/$DAY$ $HOUR$:$MINUTE$
* @brief : $brief$
*****************************************************************************/
3、Edit VA Snippets用到的宏
- 1Date
- 2 $DATE$ Year/month/day formatted as %04d/%02d/%02d
- 3 $DAY$ Day of month formatted as %d
- 4 $DAY_02$ Day of month formatted as %02d
- 5 $DAYNAME$ Three-character abbreviation of day
- 6 $DAYLONGNAME$ Full name of day
- 7 $MONTH$ Month formatted as %d
- 8 $MONTH_02$ Month formatted as %02d
- 9 $MONTHNAME$ Three-character abbreviation of month
- 10 $MONTHLONGNAME$ Full name of month
- 11 $YEAR$ Year formatted as %d
- 12 $YEAR_02$ Year formatted as %02d
- 13Time
- $HOUR$ Hour formatted as %d
- 14 $HOUR_02$ Hour formatted as %02d
- 15 $MINUTE$ Minute formatted as %02d
- 16 $SECOND$ Second formatted as %02d
- 17File
- 18 $FILE$ Full filename with path*
- 19 $FILE_UPPER$ Full filename with path in uppercase*
- 20 $FILE_BASE$ Filename without path or extension*
- 21 $FILE_BASE_UPPER$ Filename without path or extension in upper case*
- 22 $FILE_EXT$ Filename extension*
- 23 $FILE_EXT_UPPER$ Filename extension in upper case*
- 24 $FILE_PATH$ Path of file*
- 25 $FILE_PATH_UPPER$ Path of file in upper case*
- 26General
- 27 $clipboard$ Current clipboard
- 28 $end$ Position of caret after expansion
- 29 $selected$ Current selection**
- 30 $$ Literal '$' character
- 31Symbol Context
- 32 $MethodName$ Name of containing method
- 33 $MethodArgs$ Method parameters
- 34 $ClassName$ Name of containing class
- 35 $BaseClassName$ Name of base class of containing class
- 36 $NamespaceName$ Name of innermost containing namespace
- 37GUID
- 38 $GUID_DEFINITION$ Generated GUID formatted for use in a definition
- 39 $GUID_STRING$ Generated GUID formatted for use in a string
- 40 $GUID_STRUCT$ Generated GUID formatted for use in a struct
- 41Refactor
- 42 $GeneratedPropertyName$ Property name generated during Encapsulate Field
- 43 $MethodArg$ One parameter of the method and its type
- 44 $MethodArgName$ One parameter of the method
- 45 $MethodArgType$ Type of one parameter of the method
- 46 $MethodBody$ Body of implementation
- 47 $MethodQualifier$ Optional qualifiers of method
- 48 $ParameterList$ Parameters separated by commas
- 49 $SymbolContext$ Context and name of method
- 50 $SymbolName$ Name of method
- 51 $SymbolPrivileges$ Access of method
- 52 $SymbolStatic$ Keyword static or blank
- 53 $SymbolType$ Return type of method
- 54 $SymbolVirtual$ Keyword virtual or blank
1Date
2 $DATE$ Year/month/day formatted as %04d/%02d/%02d
3 $DAY$ Day of month formatted as %d
4 $DAY_02$ Day of month formatted as %02d
5 $DAYNAME$ Three-character abbreviation of day
6 $DAYLONGNAME$ Full name of day
7 $MONTH$ Month formatted as %d
8 $MONTH_02$ Month formatted as %02d
9 $MONTHNAME$ Three-character abbreviation of month
10 $MONTHLONGNAME$ Full name of month
11 $YEAR$ Year formatted as %d
12 $YEAR_02$ Year formatted as %02d
13Time
$HOUR$ Hour formatted as %d
14 $HOUR_02$ Hour formatted as %02d
15 $MINUTE$ Minute formatted as %02d
16 $SECOND$ Second formatted as %02d
17File
18 $FILE$ Full filename with path*
19 $FILE_UPPER$ Full filename with path in uppercase*
20 $FILE_BASE$ Filename without path or extension*
21 $FILE_BASE_UPPER$ Filename without path or extension in upper case*
22 $FILE_EXT$ Filename extension*
23 $FILE_EXT_UPPER$ Filename extension in upper case*
24 $FILE_PATH$ Path of file*
25 $FILE_PATH_UPPER$ Path of file in upper case*
26General
27 $clipboard$ Current clipboard
28 $end$ Position of caret after expansion
29 $selected$ Current selection**
30 $$ Literal '$' character
31Symbol Context
32 $MethodName$ Name of containing method
33 $MethodArgs$ Method parameters
34 $ClassName$ Name of containing class
35 $BaseClassName$ Name of base class of containing class
36 $NamespaceName$ Name of innermost containing namespace
37GUID
38 $GUID_DEFINITION$ Generated GUID formatted for use in a definition
39 $GUID_STRING$ Generated GUID formatted for use in a string
40 $GUID_STRUCT$ Generated GUID formatted for use in a struct
41Refactor
42 $GeneratedPropertyName$ Property name generated during Encapsulate Field
43 $MethodArg$ One parameter of the method and its type
44 $MethodArgName$ One parameter of the method
45 $MethodArgType$ Type of one parameter of the method
46 $MethodBody$ Body of implementation
47 $MethodQualifier$ Optional qualifiers of method
48 $ParameterList$ Parameters separated by commas
49 $SymbolContext$ Context and name of method
50 $SymbolName$ Name of method
51 $SymbolPrivileges$ Access of method
52 $SymbolStatic$ Keyword static or blank
53 $SymbolType$ Return type of method
54 $SymbolVirtual$ Keyword virtual or blank
4、官方网站http://www.wholetomato.com/products/features/vasnippets.asp
============添加快捷键============================
1. 安装好Visual Assist X,安装方法什么的就不罗嗦了
2. 打开Visual Studio
3. 选择“工具”菜单下的“选项”
4. 在弹出菜单中找到“环境→键盘”
5. 在右侧的设置页中找到“显示命令包含(C):”项
6. 在其下方的输入框中输入“VassistX”,就会在其下方出现“VassistX.”的若干操作选项
7. 选择你想要创建快捷键的操作,(我选择的是VassistX.RefactorCreateImplementation)
8. 然后在下方的“新快捷键用于:”下拉菜单中选中“文本编辑”选项
9. 之后在右侧的“按快捷键(P)”中编辑你想要为上面选择的操作对应的快捷键(这里我为我之前选择的VassistX.RefactorCreateImplementation项编辑了ALT+R的快捷键)
10. 之后,按下编辑快捷键对话框右侧的“分配”按钮
11. 这时,在之前一直空白的“选定命令的快捷键(T):”项中就会出现我们编辑好的快捷键了
参考 http://blog.youkuaiyun.com/cabinriver/article/details/8939940