source insight 添加自定义macro

  打开C:\Documents and Settings\xxxx\My Documents\Source Insight\Projects\Base文件夹下的em文件,可以看到都是由macro定义的一系列函数,附件是我改写的一个比较简单的注释宏,大家可以将它复制粘贴到该em文件里,然后按类似操作为这个宏设置一个快捷键

  当然我们还可以自己创建em文件,创建后保存到C:\Documents and Settings\xxxx\My Documents\Source Insight\Projects\Base文件夹下

然后打开 SI->project, open->BASE project.

 SI->project, add project file,将保存的em文件加入到BASE project中.

 SI->option, key assignments中, 找到你所编写的宏MACRO:InsertMark,为这个宏设置一个快捷键,比如ctrl+alt +/。

macro InsertMark()
{
    hbuf = GetCurrentBuf()
    ln = GetBufLnCur(hbuf)
    
    szTime = GetSysTime(1)
    Hour = szTime.Hour
    Minute = szTime.Minute
    Second = szTime.Second
    Day = szTime.Day
    Month = szTime.Month
    Year = szTime.Year

    if (Day < 10)
          szDay = "0@Day@"
     else
          szDay = Day
     if (Month < 10)
        szMonth = "0@Month@"
     else
          szMonth = Month

    InsBufLine(hbuf, ln, "// Add By Author [@szDay@/@szMonth@/@Year@] For ## Begin")
    InsBufLine(hbuf, ln+2, "// Add By Author [@szDay@/@szMonth@/@Year@] For ## End")
}

 

posted @ 2015-06-24 10:26  die  阅读(1047)  评论(0编辑  收藏  举报