zoukankan      html  css  js  c++  java
  • 为SourceInsight添加多行注释功能菜单

    由于项目看代码主要使用的是Source Insight,习惯了其他编辑器的多行注释功能,对此感到很不习惯,查询网上程序,可以自行添加。

    1.打开project,选择base项目中的utils.em,添加如下代码:

    macro MultiLineComment()
    
    {
    
        hwnd = GetCurrentWnd()
    
        selection = GetWndSel(hwnd)
    
        LnFirst =GetWndSelLnFirst(hwnd)      //取首行行号
    
        LnLast =GetWndSelLnLast(hwnd)      //取末行行号
    
        hbuf = GetCurrentBuf()
    
     
    
        if(GetBufLine(hbuf, 0) =="//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 + 1
    
                continue
    
            }
    
            if(StrMid(buf, 0, 1) == "/"){       //需要取消注释,防止只有单字符的行
    
                if(StrMid(buf, 1, 2) == "/"){
    
                    PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf)))
    
                }
    
            }
    
            if(StrMid(buf,0,1) !="/"){          //需要添加注释
    
                PutBufLine(hbuf, Ln, Cat("//", buf))
    
            }
    
            Ln = Ln + 1
    
        }
    
    
        SetWndSel(hwnd, selection)
    
    }
    

    2.选择Options->Key Assignment

    在command输入宏定义的名称,这里是Macro:MultiLineComment,和em中的是一致的

    一般将其添加到work Menu中,可以选择其他

    3.此时选择多行代码按快捷键就可以注释和非注释某些代码了

  • 相关阅读:
    txt换行追加写入
    np.unique( )的用法
    生成自己想要的任意颜色的图片
    183. 木材加工
    575. 字符串解码
    364. 接雨水 II
    255. Multi-string search
    433. 岛屿的个数
    591. 连接图 III
    918. 三数之和
  • 原文地址:https://www.cnblogs.com/jourluohua/p/6434008.html
Copyright © 2011-2022 走看看