天天看點

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檔案模闆配置

2.3 c函數模闆:(使用實時模闆)

/*****************************************************************************
 函 數 名  : 
 功能描述  : 
 輸入參數  : 
 輸出參數  : 無
 返 回 值  : 
 調用函數  : 
 被調函數  : 
 
 修改曆史      :
  1.日    期   : $DATE$
    作    者   : $USER$
    修改内容   : 新生成函數

*****************************************************************************/      
CLion常用插件及c檔案模闆配置
CLion常用插件及c檔案模闆配置

2.4 添加修改點

CLion常用插件及c檔案模闆配置

3.結果展示

源檔案:

CLion常用插件及c檔案模闆配置

頭檔案:

CLion常用插件及c檔案模闆配置

函數頭:

CLion常用插件及c檔案模闆配置

添加修改:

4.最後

繼續閱讀