想标记自己所编写的文档的一些默认信息,并且注明出处和作者,一个一个编写太过繁琐,和PyCharm相同,CLion也支持自动添加文件头部注释。
首先,在CLion工具栏点击FILE,点击settings,在Editor下找到File and templates,如图:
File-->settings-->Editor-->File and templates

相关的编写格式可以参加官网说明文档(http://www.jetbrains.com/help/clion/settings-file-and-code-templates.html),此列举一二:
| Variable | Description |
|---|---|
${CALL_SUPER} | Base function call signature during the override generation |
${DATE} | Current system date |
${DAY} | Current day of the month |
${DEFAULT_RETURN_VALUE} | Default return value of the function |
${DS} | Dollar sign ($). This variable is used to escape the dollar character, so that it is not treated as a prefix of a template variable. |
${END} | Caret position after you finish editing the variables |
${FILE_NAME} | Name of the new C or C++ file |
${HEADER_COMMENTS} | Always returns true and is used for testing purposes |
${HEADER_FILENAME} | Name of the header file generated for a class or a source file |
${HOUR} | Current hour |
${INCLUDE_GUARD} | Prevents repeated include of a particular header file |
${MINUTE} | Current minute |
${MONTH} | Current month |
${MONTH_NAME_FULL} | Full name of the current month (January, February, etc.) |
${MONTH_NAME_SHORT} | First three letters of the current month name (Jan, Feb, etc.) |
${NAME} | Name of the new entity (file, class, interface, and so on) |
${NAMESPACE_CLOSE} | End of a namespace block created during refactoring |
${NAMESPACE_OPEN} | Beginning of a namespace block created during refactoring |
${PRODUCT_NAME} | Name of the IDE (for example, CLion) |
${PROJECT_NAME} | Name of the current project |
${RETURN_TYPE} | Type of the function's return value (used for generating new functions) |
${SUIT_NAME} | Google test suite name |
${TEST_NAME} | Google test name |
${TIME} | Current system time |
${USER_NAME} | For Windows and Linux: login name of the current user For macOS: registered full name of the user |
${YEAR} | Current year |
本文介绍如何在CLion中设置自动文件头部注释,包括日期、用户名等变量,提高编码效率。通过简单的步骤,即可实现文件创建时自动填充作者、出处等信息。
1万+

被折叠的 条评论
为什么被折叠?



