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


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


    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

    VariableDescription
    ${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}
        修改内容   : 创建文件
    
    ******************************************************************************/
    
    /*----------------------------------------------*
     * 包含头文件                                   *
     *----------------------------------------------*/
    
    /*----------------------------------------------*
     * 外部变量说明                                 *
     *----------------------------------------------*/
    
    /*----------------------------------------------*
     * 外部函数原型说明                             *
     *----------------------------------------------*/
    
    /*----------------------------------------------*
     * 内部函数原型说明                             *
     *----------------------------------------------*/
    
    /*----------------------------------------------*
     * 全局变量                                     *
     *----------------------------------------------*/
    
    /*----------------------------------------------*
     * 模块级变量                                   *
     *----------------------------------------------*/
    
    /*----------------------------------------------*
     * 常量定义                                     *
     *----------------------------------------------*/
    
    /*----------------------------------------------*
     * 宏定义                                       *
     *----------------------------------------------*/
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50

    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}
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    在这里插入图片描述

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

    /*****************************************************************************
     函 数 名  : 
     功能描述  : 
     输入参数  : 
     输出参数  : 无
     返 回 值  : 
     调用函数  : 
     被调函数  : 
     
     修改历史      :
      1.日    期   : $DATE$
        作    者   : $USER$
        修改内容   : 新生成函数
    
    *****************************************************************************/
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    在这里插入图片描述


    在这里插入图片描述

    2.4 添加修改点

    在这里插入图片描述

    3.结果展示


    源文件:

    在这里插入图片描述


    头文件:

    在这里插入图片描述


    函数头:

    在这里插入图片描述


    添加修改:

    在这里插入图片描述

    4.最后

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

  • 相关阅读:
    Spring Cloud Ribbon面试题
    火柴排队.
    关于ElasticSearch日期格式不一致的异常,可以这么解决
    1-10嵌入式Linux系统开发与应用|嵌入式Linux|第三章 Linux编程环境
    菜鸟学Kubernetes(K8s)系列——(番外)安装Ingress-Nginx(工作原理)
    SpringCloud Alibaba(保姆级入门及操作)
    想让你的代码简洁,试试这个SimpleDateFormat类高深用法
    android 快速实现 圆角矩形控件 及 圆形控件
    为什么使用RedisDesktopManager可以连上redis,微服务似乎无法访问redis
    【Linux】文件权限、目录权限、掩码、粘滞位以及相关指令
  • 原文地址:https://blog.csdn.net/weixin_39510813/article/details/127132572