History
Article Edit this page Discussion

Source vimrc and use tags in a parent directory

From Vim Tips Wiki

(Redirected from VimTip571)
Jump to: navigation, search

Tip 571 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.

[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.


Where is this documented in the :help?


:help 'tags' and :help file-searching

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto Wiki
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Source vimrc and use tags in a parent directory"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation