枫林,Maybe my vimrc can give you some tips
"------------------------------------
"auto add tags and cscope.out
"自动递归路径增加tags和cscope.out文件
"------------------------------------
"get parent path
"获取当前路径的上一级的路径
function! GET_UP_PATH(dir)
let pos=len(a:dir)-1
while pos>0
if (a:dir[pos]=="\\" )
return strpart(a:dir,0,pos)
endif
let pos=pos-1
endwhile
return ""
endfunction
"find and add tags/cscope.out recusively
function! s:SET_TAGS()
let dir = expand("%:p:h")
while dir!=""
if findfile("tags",dir ) !=""
exec "set tags+=" . dir . "\\tags"
endif
if findfile("cscope.out",dir ) !=""
exec "cscope add " . dir . "\\cscope.out"
endif
let dir=GET_UP_PATH(dir)
endwhile
endfunction
"auto it!!!
autocmd BufEnter * call s:SET_TAGS()
2009-06-04
发件人: 枫林
发送时间: 2009-06-04 15:19:21
收件人: vim_use
抄送:
主题: how to find the tag file according to the file you are editing
hi everyone
this is a problem I meet but I don't know how to fix:
I don't konw the tag file path, but it may be in the same path as the
editing file, maybe in its parent path,or maybe in its parent parent path. I
want vim to find the tag file recusively.
if use "set autochdir", vim only searches the tag file in the same path as
the editing file
ps:
I am using GVIM7.2
thanks a lot
wayne
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---
<<inline: 14.gif>>
