python << EOF import os, re import vim # tags_file_name is the name of the tags file so # tags_file_name="project.tags" will load # ./project.tags # ../project.tags # ../../project.tags # etc.. # static_tags gets passed a string of comma ',' separated # static tags locations eg: # static_tags='/usr/local/tags,/usr/local/foo/tags' def setTags(tags_file_name="tags", static_tags=""): found_tags = "" tags = os.path.dirname(vim.current.buffer.name) while tags != "/tags": tags += "/" + tags_file_name if os.path.exists(tags): found_tags += tags + ',' tags = re.split( r"/[^/]*/[^/]*$", tags )[0] vim.command("set tags=%s%s" %(found_tags, static_tags)) EOF python setTags()