Source vimrc and use tags in a parent directory
From Vim Tips Wiki
Tip 571 • Previous Tip • Next Tip
Created: September 30, 2003 Complexity: basic Author: mosh Minimum version: 5.7 Karma: 3/2 Imported from: Tip#571
" Source .../.vimrc and use .../tags in ancestor of source directory.
" useful when you have source tree eight fathom deep,
" an exercise in Vim loops.
let parent=1
let local_vimrc = ".vimrc"
let local_tags = "tags"
while parent <= 8
if filewritable(local_vimrc)
echomsg "sourcing " . local_vimrc
exe ":so " . local_vimrc
endif
let local_vimrc = "../". local_vimrc
let local_tags = "../". local_tags
exe ":set tags+=".local_tags
let parent = parent+1
" ToDo: stop at the root on windows and ~ on unix.
endwhile
unlet parent local_vimrc
See tip 727 for a way to handle local vimrc.
[edit] References
[edit] Comments
There's a simpler way to do this for tags:
set tags+=tags;/
TO DO
Check above tip. It probably should be entirely replaced with the comment above.
Categories: VimTip | Todo
