// open the corresponding .c or .h file
macro OpenCorrespondingCorHfile()
{
//返回当前缓冲区的句柄
hcurrentbuf = getcurrentbuf ()
//返回与文件缓冲区关联的文件的名称。
bname = getbufname (hcurrentbuf)
//返回字符串的长度
len = strlen (bname)
//返回从(len-2)到(但不包括len)范围内的bname的中间字符串
if (".c" == strmid (bname, len-2, len))
{
filename = strmid (bname, 0, len-2)#".h"
}
else if (".h" == strmid (bname, len-2, len))
{
filename = strmid (bname, 0, len-2)#".c"
}
else
{
filename = nil
}
if (filename != nil)
{
//将名为filename的文件打开到文件缓冲区中,并返回文件缓冲区的句柄。
hbufnext = openbuf (filename)
if (hbufnext != hnil)
{
setcurrentbuf (hbufnext)
}
}
}
source insight脚本:源文件和头文件间切换
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.