Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2009
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. python << EOF
  2. import os, re
  3. import vim
  4.  
  5. # tags_file_name is the name of the tags file so
  6. # tags_file_name="project.tags" will load
  7. #   ./project.tags
  8. #   ../project.tags
  9. #   ../../project.tags
  10. #   etc..
  11. # static_tags gets passed a string of comma ',' separated
  12. # static tags locations eg:
  13. #   static_tags='/usr/local/tags,/usr/local/foo/tags'
  14. def setTags(tags_file_name="tags", static_tags=""):
  15.  
  16.     found_tags = ""
  17.  
  18.     tags = os.path.dirname(vim.current.buffer.name)
  19.     while tags != "/tags":
  20.         tags += "/" + tags_file_name
  21.         if os.path.exists(tags):
  22.             found_tags += tags + ','
  23.         tags = re.split( r"/[^/]*/[^/]*$", tags )[0]
  24.  
  25.     vim.command("set tags=%s%s" %(found_tags, static_tags))
  26.  
  27.  
  28. EOF
  29.  
  30. python setTags()
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement