Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 22nd, 2009  |  syntax: Python  |  size: 0.75 KB  |  hits: 47  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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()