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、再打开一个项目,试试你刚刚设定的快捷键吧!!!