对于一直使用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. Java学习笔记22(List接口)

    List接口继承自Collection接口,自身具有三大特点: 1.有序集合:存入和取出的顺序一致: 2.此接口的用户可以对每个元素插入位置进行精确控制:可以通过索引操作元素 3.可以存储重复元素 L ...

  2. 20165228 2017-2018-2 《Java程序设计》第2周学习总结

    20165228 2017-2018-2 <Java程序设计>第2周学习总结 教材学习内容总结 标识符:名字 组成:字母/下划线/美元符号或数字 注意:标识符的第一个字符不能是数字字符,且 ...

  3. Django组件之分页器

    分页器 简单的分页器实现 views.py from django.core.paginator import Paginator,EmptyPage,PageNotAnInteger from ap ...

  4. Arrays 类的 binarySearch() 数组查询方法详解

    Arrays类的binarySearch()方法,可以使用二分搜索法来搜索指定的数组,以获得指定对象.该方法返回要搜索元素的索引值.binarySearch()方法提供多种重载形式,用于满足各种类型数 ...

  5. xdoj-1298(模拟--简易SQL解释器)

    题目链接 一 知识点: 1  substr有2种用法:       假设:string s = "0123456789";      string sub1 = s.substr( ...

  6. 启动tomcat报错:Failed to start component [StandardEngine[Catalina].StandardHost[localhost]

    1.右键点击需要启动的tomcat,选择Clean和Clean Tomcat Work Directory,清除即可!

  7. hdu6441 Find Integer (费马大定理)

    #include<bits/stdc++.h> using namespace std; int main() { int T; scanf("%d",&T); ...

  8. 《DSP using MATLAB》Problem 6.14

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  9. python中的print函数

    python3.x中将print由一个声明转变成了一个函数. 官方说法: Converts the print statement to the print() function. print(*ob ...

  10. cdcq的独立博客上线辣!-> http://cdcq.coding.me/blog/

    cdcq的独立博客上线辣!-> http://cdcq.coding.me/blog/ 这个博客会逐渐停更 独立博客被硬盘保护吃掉了,直到省选前独立博客应该不会再上线 (如果没进队就永远不会上线 ...