对于一直使用sourceinsight编辑C/C++代码的工程师们,sourceinsight是一个非常好用的编辑工具可以任意定位,跳转,回退,本人一直使用该工具做C/C++开发,sourceinsight能够满足我的大部分需求,但是有些功能没有总觉得是一个缺憾。源码链接:链接:https://pan.baidu.com/s/1DpGV75XeSpQrP1BlFbYHHg 密码:bqq6

<1>.在SourceInsight里使用"#if 0 #endif"注释,可用下面的方法添加宏插件。

  • 在C:\Users\计算机名\Documents\Source Insight\Projects\Base中有个utils.em文件.打开编辑(注:最好预先备份utils.em)
  • 在文档的最后添加以下代码.
 macro Custom_AddMacroComment()//Alt+1
{ //add #if 0 #endif
hwnd=GetCurrentWnd()
sel=GetWndSel(hwnd)
lnFirst=GetWndSelLnFirst(hwnd)
lnLast=GetWndSelLnLast(hwnd)
hbuf=GetCurrentBuf() if (LnFirst == )
{
szIfStart = ""
}
else
{
szIfStart = GetBufLine(hbuf, LnFirst-)
} szIfEnd = GetBufLine(hbuf, lnLast+) if (szIfStart == "#if 0" && szIfEnd =="#endif")
{
DelBufLine(hbuf, lnLast+)
DelBufLine(hbuf, lnFirst-)
sel.lnFirst = sel.lnFirst –
sel.lnLast = sel.lnLast –
}
else
{
InsBufLine(hbuf, lnFirst, "#if 0")
InsBufLine(hbuf, lnLast+, "#endif")
sel.lnFirst = sel.lnFirst +
sel.lnLast = sel.lnLast +
}
SetWndSel( hwnd, sel )
}
  • 打开任意一个SI工程,点击Project->Open Project->Base,以此打开Base工程(此工程是SI的默认基础工程,如果不打开Base工程,在后面的操作中将不会显示所添加的宏),然后关闭此工程.
  • 再打开任意一个SI工程,点击Options->Key Assignments,然后查找Custom_AddMacroComment

  • 点击Assign New Key,此时输入键盘上想设置的快捷键(觉得Alt+X比较顺手).点击OK.

<2>.在SourceInsight里使用多行“//”注释,可用下面代码添加宏插件,方法如<1>.

 macro Custom_MultiLineComment()//Alt+2
{ //comment multiple lines
hwnd = GetCurrentWnd()
selection = GetWndSel(hwnd)
LnFirst = GetWndSelLnFirst(hwnd)
LnLast = GetWndSelLnLast(hwnd)
hbuf = GetCurrentBuf() if(GetBufLine(hbuf, ) == "//magic-number:tph85666031")
{
stop
} Ln = Lnfirst
buf = GetBufLine(hbuf, Ln)
len = strlen(buf) while(Ln <= Lnlast)
{
buf = GetBufLine(hbuf, Ln)
if(buf == "")
{
Ln = Ln +
continue
} if(StrMid(buf, , ) == "/")
{
if(StrMid(buf, , ) == "/")
{
PutBufLine(hbuf, Ln, StrMid(buf, , Strlen(buf)))
}
} if(StrMid(buf,,) != "/")
{
PutBufLine(hbuf, Ln, Cat("//", buf))
}
Ln = Ln +
} SetWndSel(hwnd, selection)
}

<3>.在SourceInsight里去除多行“//”注释,可用下面代码添加宏插件,方法如<1>.

 macro Custom_RemoveMultiLineComment()//Alt+3
{ //Uncomment multiple lines
hwnd = GetCurrentWnd()
selection = GetWndSel( hwnd )
lnFirst = GetWndSelLnFirst( hwnd )
lnLast = GetWndSelLnLast( hwnd ) hbuf = GetCurrentBuf()
ln = lnFirst
while( ln <= lnLast )
{
buf = GetBufLine( hbuf, ln )
len = strlen( buf )
if( len >= )
{
start = while( strmid( buf, start, start + ) == CharFromAscii() || strmid( buf, start, start + ) == CharFromAscii() )
{
start = start +
if( start >= len )
break
}
if( start < len - )
{
if( strmid( buf, start, start + ) == "//" )
{
buf2 = cat( strmid( buf, , start ), strmid( buf, start + , len ) )
PutBufLine( hbuf, ln, buf2 )
}
}
}
ln = ln +
}
SetWndSel( hwnd, selection )
}

代码非原创,如有侵权,请联系删除

SourceInsight宏插件1(非常好用,强力推荐)的更多相关文章

  1. SourceInsight宏插件3(非常好用,强力推荐)

    openfolder.em源码:(链接:https://pan.baidu.com/s/1draaimWzCHZ3vLxL--lfiQ  提取码:zyq4) //使用资源管理器打开当前文件所在文件夹, ...

  2. SourceInsight宏插件2(非常好用,强力推荐)

    Quicker宏在SI中的使用方法(下载地址:链接:https://pan.baidu.com/s/1VrDxlPhft7RPUCCOKxsGIg  提取码:2d4u) Quicker宏的添加到SI中 ...

  3. 利用sourceinsight宏(Quicker.em)提高编码效率和质量

    利用sourceinsight宏(Quicker.em)提高编码效率和质量Marco是sourceinsight软件一个强大的功能,用户可以通过编写宏来实现自定义功能.这里有个比较流行的宏文件quic ...

  4. 非常适用的Sourceinsight插件,提高效率【强力推荐】

    转自:http://www.cnblogs.com/heiyue/p/6225975.html 一直使用sourceinsight编辑C/C++代码,sourceinsight是一个非常好用的编辑工具 ...

  5. quicker+.em SourceInsight 宏加强版制作

    这两天苦于新建的文件每次都要手动添加文件头,新建的函数每次都要手动添加函数说明,连.h也要手动生成.于是乎,上网搜了搜,发现了lushengwen写的一个神器:quicker.em .好家伙,有了这个 ...

  6. 我的Android进阶之旅------>经典的大牛博客推荐(排名不分先后)!!

    本文来自:http://blog.csdn.net/ouyang_peng/article/details/11358405 今天看到一篇文章,收藏了很多大牛的博客,在这里分享一下 谦虚的天下 柳志超 ...

  7. 如何让Ubuntu系统支持WebP图片格式

    本文主要向大家介绍如何让 Ubuntu 系统支持查看 WebP 图片格式,以及如何将 WebP 转为 JPEG 或 PNG 图片格式的方法. 什么是WebP图片 Google开发并推出 WebP 图片 ...

  8. excel多个sheet表拆分成独立的excel文件

    一.问题: 公司做一个项目,给的用户上报文是一个包含多个sheet页的excel文件, 但是在实际处理报文数据的时候需要拆分excel文件为多个独立的报文excel文件 二.解决: (1)一个一个的复 ...

  9. 性能测试之nmon对linux服务器的监控

    大家都知道在做性能测试的时候,需要监控服务器的资源情况,而大多数服务器是Linux系统,网上资料嘿多,这里汇总介绍下Nmon监控工具: -------------------------------- ...

随机推荐

  1. dd 命令的使用

    linux 下dd命令直接清除分区表(不用再fdisk一个一个的删除啦) 分区表是硬盘的分区信息,要删除一个硬盘的所有分区表很麻烦的,需要fdisk一个一个的删除,其实dd命令可直接清除分区信息,当然 ...

  2. 使用golang编写prometheus metrics exporter

    metrcis输出 collector.go package main import ( "github.com/prometheus/client_golang/prometheus&qu ...

  3. 【Maven】Project configuration is not up-to-date with pom.xml错误解决方法

    导入一个Maven项目之后发现有一个如下的错误: Project configuration is not up-to-date with pom.xml. Run project configura ...

  4. endnote插入文献的一些问题

    1. 文末参考文献前面加上序号 eg.[1] 设置如下图,参考网址https://zhidao.baidu.com/question/360201207639069172.html edit-> ...

  5. spring mvc EL ModelAndView的 Model 值 在jsp中不显示

    问题:spring mvc开发过程中, 经常会给model addAttribute, 然后通过EL在jsp中显示,比如 ${msg}, 但是有时候会出现jsp最后显示的还是${msg},而不是msg ...

  6. PHP设计模式之工厂模式(转)

    概念 工厂模式是我们最常用的实例化对象模式,是用工厂方法代替new操作的一种模式. 使用工厂模式的好处是,如果你想要更改所实例化的类名等,则只需更改该工厂方法内容即可,不需逐一寻找代码中具体实例化的地 ...

  7. pip install GitHub package

    /********************************************************************************* * pip install Git ...

  8. NYOJ 12:喷水装置(二)(贪心,区间覆盖问题)

    12-喷水装置(二) 内存限制:64MB 时间限制:3000ms 特判: No 通过数:28 提交数:109 难度:4 题目描述: 有一块草坪,横向长w,纵向长为h,在它的橫向中心线上不同位置处装有n ...

  9. difference among String,StringBuilder,StringBuffer

    difference among String,StringBuilder,StringBuffer String常用构造函数 String(byte[] bytes) String(byte[] b ...

  10. mysql再探

    select子句及其顺序 select from where group by having order by limit 创建表 create table student(id int not nu ...