1、打开source insight安装目录中的utils.em文件,将下面的代码添加到最末尾
macro MultiLineComment()
{
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) //取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)
}
2、打开SourceInsight, Options->Key Assignments
分配快捷键“Ctrl +/”
反注释分配快捷键“SHIFT + Ctrl +/”