1. Source Insight Project menu -> Open Project -> Base Project Open.
中文版如下:项目菜单->打开项目->选择Base
2. Base Project ,打开后,在ProjectFiles列表中选择默认的 Utils.em 文件打开 .
3. 把下面的代码加进去之后 保存一下. 此时 email 地址按照自己的email修改一下.
// ccl add for hotkey
macro InsertSingleLineComment()
{
hsystemtime = GetSysTime(1)
hyear = hsystemtime.Year
hmonth = hsystemtime.Month
if( hmonth <10 )
hmonth = cat("0",hmonth)
hday = hsystemtime.Day
if( hday <10 )
hday = cat("0",hday)
hwnd = GetCurrentWnd()
lnFirst = GetWndSelLnFirst(hwnd)
hbuf = GetCurrentBuf()
InsBufLine(hbuf, lnFirst, "//@hyear@@hmonth@@hday@, changliang.chen\@lge.com, DetailDescription")
}
4. 在选项菜单中添加快捷键:Option -> Key assignment 中的 Command 里输入或查找:新定义的 Macro(“Macro: InsertSingleLineComment” )
6. Assign New Key 点击后 key(예: CTRL+SHIFT+/) 输入后 OK //热键值使用者可自定义.
7. 代码中选中某行,按下Hot key(如: “CTRL+SHIFT+/”) 按下后就会自动添加注释了
多行的注释宏定义如下,配置方法与上面的步骤一致。
macro InsertMultiLineComment()
{
hsystemtime = GetSysTime(1)
hyear = hsystemtime.Year
hmonth = hsystemtime.Month
if( hmonth <10 )
hmonth = cat("0",hmonth)
hday = hsystemtime.Day
if( hday <10 )
hday = cat("0",hday)
hwnd = GetCurrentWnd()
lnFirst = GetWndSelLnFirst(hwnd)
lnLast = GetWndSelLnLast(hwnd)
hbuf = GetCurrentBuf()
InsBufLine(hbuf, lnFirst, "//@hyear@@hmonth@@hday@, changliang.chen\@lge.com, DetailDescription [START]")
InsBufLine(hbuf, lnLast+2, "//@hyear@@hmonth@@hday@, changliang.chen\@lge.com, DetailDescription [END]")
}
本文介绍了如何在Source Insight中设置自定义快捷键以实现快速添加单行和多行注释的功能。通过编辑宏,用户可以个性化注释格式,并为宏分配快捷键,提高代码注释效率。
320

被折叠的 条评论
为什么被折叠?



