Source Insight多行注释宏定义
Source Insight 是一个非常强大的代码阅读、编辑工具,常用的还有Sublime、Notepad++等。Source Insight本身并不支持代码注释,但是提供了宏命令的支持,为自定义命令提供了可能。本文参照网上的代码,加以修改,跳过空格、TAB,达到类似Sublime注释的效果。
使用方法是将下面代码另存为xxx.em文件,打开source insight,将该文件添加到工程中,然后在Options->KeyAssignments中你就可以看到这个宏了,宏的名字是MultiLineComments,然后为它分配快捷键就可以了。
以C语言”// “注释、SI 3.5为例。
代码
macro MultiLineComment() {
hwnd = GetCurrentWnd()
selection = GetWndSel(hwnd)
LnFirst =GetWndSelLnFirst(hwnd) //取首行行号
LnLast =GetWndSelLnLast(hwnd) //取末行行号
hbuf = GetCurrentBuf()
if(GetBufLine(hbuf, 0) =="//magic-number:tph85666031"