Source Insight利用宏文件实现多行快速注释以及其他超级好用的功能

前言

Source insight是一款非常优秀的代码阅读软件,但是有些地方还是不够完善,比如没有快速对一段代码进行注释的功能。对于此类需求,我们可以借助宏来实现。网上有很多source insight的宏,这里只介绍我觉得比较好用的几个。

MultiLineComment.em:实现多行注释的宏代码

AddMacroComment.em:实现添加“#if 0”和“#endif”的宏代码

quicker.em: 该宏功能扩展文件是华为某员工进行整理和开发的,功能十分强大

一、安装source insight宏

1、将宏文件放入工程代码所在的文件夹
在这里插入图片描述

2、将宏文件添加到工程中

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

二、设置宏快捷键

1、Options->Key Assignments,找到Macro: MultiLineComment,添加快捷键即可,推荐使用**Ctrl+/**组合键。

在这里插入图片描述

2、Options->Key Assignments,找到Macro: AddMacroComment,添加快捷键即可,推荐使用Ctrl+3组合键(数字3对应#号,方便记忆)。

在这里插入图片描述

3、Options->Key Assignments,找到Marco:AutoExpand,添加快捷键即可,推荐使用Ctrl+Enter组合键。(这里用到了quicker.em)

在这里插入图片描述

三、测试快捷键

1、Ctrl + / 多行注释

在这里插入图片描述

2、Ctrl + 3 添加“#if 0”和“#endif”
在这里插入图片描述

四、quicker.em使用介绍

使用方法

在文件空白处输入 quicker.em 支持的命令,按下 Ctrl+Enter 即可

支持命令

/*==============================================*
 *====== List Quicker supports commands ========*
 *----------------------------------------------*
 *
 *  /*             auto fill comment according to standard C format
 *  //             auto fill comment according to standard C format
 *  {              auto add right curly bace
 *
 *  name           auto record author's name
 *  if             auto insert if condition statements template
 *  ef             auto insert else if condition statements template
 *  ife            auto insert if/else condition statements template
 *  ifs            auto insert if/else if/else condition statements template
 *  else/ei        auto insert else statements template
 *
 *  switch/sw      auto insert switch/case statements template
 *  case/ca        auto insert case/break statements template
 *
 *  for            auto insert for loop statements template
 *  fo             auto insert for loop statements template
 *  while/wh       auto insert while loop statements template
 *  do             auto insert do/while loop statements template
 *
 *  func/fu        auto insert function header description template
 *  file/fi        auto insert file header description template
 *  hi             auto insert new history record in history comment
 *  struct/st      auto insert typedef struct statements template
 *  enum/en        auto insert typedef enum statements template
 *
 *  ap             auto insert problem number and description comment
 *
 *  pn             set problem number used by below command
 *
 *  ab             auto insert add begin description for assigned PN comment
 *  ae             auto insert add end description for assigned PN comment
 *  db             auto insert delete begin description for assigned PN comment
 *  de             auto insert delete end description for assigned PN comment
 *  mb             auto insert modify begin description for assigned PN comment
 *  me             auto insert modify end description for assigned PN comment
 *  abg            auto insert add begin and end description for assigned PN comment
 *  mbg            auto insert modify begin and end description for assigned PN comment
 *  dbg            auto insert delete begin and end description for assigned PN comment
 *
 *  hd             auto create .h header file for current .c file
 *  hdn            auto create new .h header file for current .c file
 *
 *  key            list Source Insight default shortcut keys
 *  cmd/help       list Quicker supports commands just this showed
 *
 *  #if            auto insert #if statements template
 *  #ifd/#ifdef    auto insert #ifdef statements template
 *  #ifn/#ifndef   auto insert #inndef statements template
 *
 *  cpp            auto insert extern C statements template
 *  tab            auto expand tab to assigned spaces
 *
 *----------------------------------------------*
 *======= End Quicker supports commands ========*
 *==============================================*/

使用演示

1、输入help ,按Ctrl+Enter查看所支持的命令

在这里插入图片描述

2、输入fi ,按Ctrl+Enter创建文件说明
在这里插入图片描述

以上宏文件及更多宏文件获取渠道:https://wwu.lanzoul.com/iYCqE0amkdde

  • 3
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值