http://blog.chinaunix.net/uid-27213819-id-3810619.html source insight并没有提供这样的快捷键,有时候用着比较烦人。终于找到了方法:使用宏命令,并设置快捷键与之绑定。 1、打开source insight,Project - Open Project,打开Base项目,注:Base项目是
http://blog.chinaunix.net/uid-27213819-id-3810619.html
source insight并没有提供这样的快捷键,有时候用着比较烦人。终于找到了方法:使用宏命令,并设置快捷键与之绑定。
1、打开source insight,Project -> Open Project,打开Base项目,注:Base项目是source insight默认已经创建的。
2、打开Utils.em文件,在该文件的末尾加入如下内容:
/*
cpp和hpp文件互换(当前只支持同一目录下的文件互换)
*/
macro switch_cpp_hpp()
{
hwnd = GetCurrentWnd()
hCurOpenBuf = GetCurrentBuf()
if (hCurOpenBuf == 0)
stop
curOpenFileName = GetBufName(hCurOpenBuf)
curOpenFileNameLen = strlen(curOpenFileName)
// 文件类型临时缓冲区
strFileExt = NewBuf("strFileExtBuf")
ClearBuf(strFileExt)
// 头文件类型
index_hpp_begin = 0 // 头文件开始索引
AppendBufLine(strFileExt, ".h")
AppendBufLine(strFileExt, ".hpp")
index_hpp_end = GetBufLineCount(strFileExt) // 头文件结束索引
// 源文件类型
index_cpp_begin = index_hpp_end // 源文件开始索引
AppendBufLine(strFileExt, ".c")
AppendBufLine(strFileExt, ".cpp")
AppendBufLine(strFileExt, ".cc")
AppendBufLine(strFileExt, ".cx")
AppendBufLine(strFileExt, ".cxx")
index_cpp_end = GetBufLineCount(strFileExt) // 源文件结束索引
isCppFile = 0 // 0:未知 1:头文件 2:源文件,默认未知扩展名
curOpenFileExt = "" // 当前打开文件的扩展名
index = index_hpp_begin
// 遍历头文件,判断是否当前打开文件是头文件类型
while(index 3、关闭Base项目,重新打开Source Insight。
4、打开Option -> Key Assignments。在Command栏选中“Macro: switch_cpp_hpp”;点击Assign New Key按钮设置快捷键(Ctrl+·),点击OK,就设定好了。
5、再打开一个项目,试试你刚刚设定的快捷键吧!!!
查看更多关于SourceInsight技巧:头文件和实现文件快捷键打开的方式的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did95707