source insight 设置添加自动注释语句宏

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]")
}


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值