CLion常用插件及c文件模板配置

CLion常用插件及c文件模板配置

文章目录

  • CLion常用插件及c文件模板配置
    • 1.常用插件
    • 2.模板
      • 2.1 c源文件模板:(使用文件模板)
      • 2.2 c头文件模板:(使用文件模板)
      • 2.3 c函数模板:(使用实时模板)
      • 2.4 添加修改点
    • 3.结果展示
    • 4.最后

1.常用插件

  • Chinese (Simplified) Language Pack / 中文语言包
  • Monokai Pro Theme (主题theme插件)
  • idea vim(idea的vim插件)
  • codeglance(代码预览,右侧可以预览代码)
  • Rainbow Brackets(彩虹括号,花括号的代码会有竖线关联)

2.模板

参考:https://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
${DIR_PATH} Path to the directory of the new file (relative to the project root)
${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.
${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
${SECOND} Current second
${MONTH} Current month
${MONTH_NAME_FULL} Full name of the current month (January, February, and so on)
${MONTH_NAME_SHORT} First three letters of the current month name (Jan, Feb, and so on)
${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} Login name of the current user (all platforms)
${USER_NAME} For Windows and Linux: login name of the current user
For macOS: registered full name of the user
${YEAR} Current year

2.1 c源文件模板:(使用文件模板)

/******************************************************************************

                  版权所有 (C), ${YEAR}-${YEAR},${USER_NAME}

 ******************************************************************************
  文 件 名   : ${FILE_NAME}
  版 本 号   : 初稿
  作    者   : ${USER_NAME}
  生成日期   : ${DATE}
  最近修改   :
  功能描述   : 
  函数列表   :
  修改历史   :
  1.日    期   : ${DATE}
    作    者   : ${USER_NAME}
    修改内容   : 创建文件

******************************************************************************/

/*----------------------------------------------*
 * 包含头文件                                   *
 *----------------------------------------------*/

/*----------------------------------------------*
 * 外部变量说明                                 *
 *----------------------------------------------*/

/*----------------------------------------------*
 * 外部函数原型说明                             *
 *----------------------------------------------*/

/*----------------------------------------------*
 * 内部函数原型说明                             *
 *----------------------------------------------*/

/*----------------------------------------------*
 * 全局变量                                     *
 *----------------------------------------------*/

/*----------------------------------------------*
 * 模块级变量                                   *
 *----------------------------------------------*/

/*----------------------------------------------*
 * 常量定义                                     *
 *----------------------------------------------*/

/*----------------------------------------------*
 * 宏定义                                       *
 *----------------------------------------------*/

2.2 c头文件模板:(使用文件模板)

/******************************************************************************

                  版权所有 (C), ${YEAR}-${YEAR}, ${USER_NAME}

 ******************************************************************************
  文 件 名   : ${FILE_NAME}
  版 本 号   : 初稿
  作    者   : ${USER_NAME}
  生成日期   : ${DATE}
  最近修改   :
  功能描述   : 
  函数列表   :
  修改历史   :
  1.日    期   : ${DATE}
    作    者   : ${USER_NAME}
    修改内容   : 创建文件

******************************************************************************/

#[[#ifndef]]# ${INCLUDE_GUARD}
#[[#define]]# ${INCLUDE_GUARD}

#[[#endif]]# //${INCLUDE_GUARD}

CLion常用插件及c文件模板配置_第1张图片

2.3 c函数模板:(使用实时模板)

/*****************************************************************************
 函 数 名  : 
 功能描述  : 
 输入参数  : 
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : $DATE$
    作    者   : $USER$
    修改内容   : 新生成函数

*****************************************************************************/

CLion常用插件及c文件模板配置_第2张图片


CLion常用插件及c文件模板配置_第3张图片

2.4 添加修改点

CLion常用插件及c文件模板配置_第4张图片

3.结果展示


源文件:

CLion常用插件及c文件模板配置_第5张图片


头文件:

CLion常用插件及c文件模板配置_第6张图片


函数头:

CLion常用插件及c文件模板配置_第7张图片


添加修改:

CLion常用插件及c文件模板配置_第8张图片

4.最后

其实我们还可以将这些模版开发成插件上传到插件市场(Java就可以开发),这些留给以后折腾吧,感兴趣的可以自行先研究一下。

你可能感兴趣的:(c,开发工具,c语言,ide,CLion,C开发工具)