Skip to content
Browse files

Version 0.10: Initial upload

  • Loading branch information...
0 parents commit 28be919fe40d37f9a688463cf43b15476048f683 @awakenrz awakenrz committed with
Showing with 26 additions and 0 deletions.
  1. +10 −0 README
  2. +16 −0 plugin/ctagloader.vim
10 README
@@ -0,0 +1,10 @@
+This is a mirror of http://www.vim.org/scripts/script.php?script_id=4268
+
+This script will automatically traverse your path tree from the current directory all the way to root and load tags files found along the way.
+This is often useful when you have a root ctag file for your project and you often work in some subdirectories of your projects.
+For example, if you have a project structured as follows:
+foo/
+ bar/
+ baz/
+There is a ctag file (often named as tags/TAGS) in foo/ and you constantly work in foo/bar/ or foo/baz/
+Say you are now in foo/bar/. If you execute "vim hello_world.c", the ctag file in foo/ will be found and loaded.
16 plugin/ctagloader.vim
@@ -0,0 +1,16 @@
+function! SetCTags()
+ let curdir = split(substitute(system('pwd'), "\n", "", ""), "/")
+ let ctagdir = ""
+ for folder in curdir
+ let ctagdir .= "/" . folder
+ let ctagfile = substitute(system('ls ' . ctagdir . '/tags'), "\n", "", "")
+ if match(ctagfile, "^.*tags$") != -1
+ execute 'autocmd BufEnter * :setlocal tags+=' . ctagfile
+ endif
+ endfor
+ unlet ctagdir
+ unlet ctagfile
+ unlet curdir
+endfunc
+
+call SetCTags()

0 comments on commit 28be919

Please sign in to comment.
Something went wrong with that request. Please try again.