前言
主要功能:
- 双击"/":插入单行注释
- 输入"/"或“#”+名字+空格:一键插入指定注释。
1)/file:插入文件头注释,通常在.c文件开头使用,
2)/head:插入.h文件模板
3)/func:插入函数注释 - 输入"#"+类型+空格:一键插入代码模板
1)#type:插入结构体模板
2)#if:插入if模板
3)#sw:插入switch模板
内容可以自行修改,更多功能也可以自行添加
代码
#Requires AutoHotkey v2.0 ; Doxygen风格注释热键 ; 文件信息 file_info := ' ( / * @file #filename# * @brief This is a brief description. * @details This is the detail description. * @author 霖夜妖妖 * @date date * @version V0.01 * @par Copyright (c): * XXX公司 * @par History: * version: author, date, desc */ )' ; 头文件 head_info := ' ( #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif )' ; 函数注释 func_info := ' ( / * @brief 自定义类别的member_funtion说明… * @param[in] int a 参数a的说明 * @param[out] int b 参数b的说明 * @return 传回a+b */ )' ; 全局变量注释 gloab_info := ' ( / Description of global variable */ )' ; 代码注释(Doxygen 对于批注是视为在解释后面的程序代码,因此批注前面的代码需要使用下面格式,即//用于解释后面代码,///<用于解释前面代码) code_info := ' ( ///< Description of the member variable )' str_past(str) { old := ClipboardAll() A_Clipboard := str Send("^v") Sleep(100) A_Clipboard := old } ~$/::{ if (KeyWait("/", "T0.2")) { if (KeyWait("/", "D T0.2")) ; Double press { ; MsgBox("Double press") Send("{BackSpace 2}") str_past(code_info) } else ; Single press { ; MsgBox("Single press") ; Send("/") } } else ; Long press { ; MsgBox("Long press") Send("{BackSpace}") str_past(gloab_info) Sleep(100) } } ::#file:: ::/file::{ str_past(file_info) } ::#head:: ::/head::{ str_past(head_info) } ::#func:: ::/func::{ str_past(func_info) } ::#type:: { str := ' ( typedef struct _xxx_s { uint8_t a; }xxx_t; )' str_past(str) } ::#if:: { str := ' ( if { } esle { } )' str_past(str) } ::#sw:: { str := ' ( switch(xxx){ case 1: break; default: break; } )' str_past(str) }
讯享网
配合GUI和文件操作就是一键代码生成器,甚至可以直接生成整个工程。不过工程比较大的话,就不适合用str的形式写到代码里了,可以考虑用下载,模板代码保存到github,然后脚本访问并下载下来,修改工程部分文件或内容。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/50172.html