(Move categories to tip template) |
(Remove html character entities) |
||
Line 18: | Line 18: | ||
let local_vimrc = ".vimrc" |
let local_vimrc = ".vimrc" |
||
let local_tags = "tags" |
let local_tags = "tags" |
||
− | while parent |
+ | while parent <= 8 |
if filewritable(local_vimrc) |
if filewritable(local_vimrc) |
||
echomsg "sourcing " . local_vimrc |
echomsg "sourcing " . local_vimrc |
Revision as of 08:57, 29 September 2008
Tip 571 Printable Monobook Previous Next
created September 30, 2003 · complexity basic · author mosh · version 5.7
" 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.
References
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.