1. SourceInsight自定义快捷键
在打开软件后,点击Option选项,
接着点击key Assignments,输入自己需要改变的自定义快捷键。
如GO BACK该快捷键为Alt +,可是我并不习惯用这个,点击该选项,点击Assign New key后弹出下列框。
接着输入要自定义的命令。如我输入的是Alt +1,则在编辑代码是,我按下Alt +1这个命令后, 软件编辑则为返回上一个已记录好的位置。这样用起来则会感觉很爽。
其他的命令则按照上面的方式制作。
2、添加软件本身不支持的命令
在代码编辑中,经常会遇到一个问题,写注释,很多时候,需要注释掉一段代码,需要写注释写该函数的功能,返回值,作者,日期,参数等。这会涉及到重复多次的写。因此,如果有一个命令,点击该命令,帮你写一个模板,生成作者,日期,那该多好。下面就是实现了以上的功能。
(1)sourceinsight添加work菜单。
打开软件,点击Option选项,点击menu Assignments,选中menu中的work,在command选项中添加macro,选中自定义的命令到work,选中后点击insert,点击OK后则该命令出现在软件work目录下。
3、如何添加自定义命令
部分代码贴出
macro InsertFunctionHeader()
{
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
szFunc = GetCurSymbol()
nLine = GetBufLnCur(hbuf)//GetSymbolLine(szFunc)
//此处写自己的名字
szMyName = "sky"
szDate = GetSysTime(1)
// Get current time
szDate = GetSysTime(1)
Day = szDate.Day
Month = szDate.Month
Year = szDate.Year
if (Day < 10)
szDay = "0@Day@"
else
szDay = Day
szMonth = Month;
InsBufLine(hbuf, nLine, " ")
InsBufLine(hbuf, nLine + 1, "/******************************************************************************")
InsBufLine(hbuf, nLine + 2, " Function: @szFunc@")
InsBufLine(hbuf, nLine + 3, " Description: ")
InsBufLine(hbuf, nLine + 4, " INPUT: ")
InsBufLine(hbuf, nLine + 5, " OUTPUT: ")
InsBufLine(hbuf, nLine + 6, " Return: ")
InsBufLine(hbuf, nLine + 7, " Revision: ")
InsBufLine(hbuf, nLine + 8, " 1. Author: @szMyName@")
InsBufLine(hbuf, nLine + 9, " Date: @Year@/@szMonth@/@szDay@")
InsBufLine(hbuf, nLine + 10, " Changes: First create ")
InsBufLine(hbuf, nLine + 11, " ******************************************************************************/")
// put the insertion point inside the header comment
//SetBufIns(hbuf, nLine, 12)
}
4、如何打开编辑新增自定义命令
关闭所有的工程后,如图
打开base工程
如下图所示
在这里编辑你需要自定义的命令,此处编辑自定义代码可能存在权限的问题,使得无法编辑。请使用管理员权限打开。如果仍是无法编辑,则进入自己安装的软件文档目录下使用文本编辑器notepad打开编辑。
如我的目录的存放该utils.em在目录的D:\Documents\Source Insight 4.0\Projects\Base下。如不知utils.em在哪里请自己在电脑搜索。
以下有我本人自己写的部分的utils.em代码。日常工作可以正常使用。如没有一些功能,可以自己添加
https://download.csdn.net/download/shaohuayishi2434/10188648
来源:CSDN
作者:我爱萝莉fc
链接:https://blog.csdn.net/shaohuayishi2434/article/details/81069044