Vim Tips Wiki

Read tag files from all directories in your path

1,623pages on
this wiki
Add New Page
Add New Page Talk0
Tip 1028 Printable Monobook Previous Next

created 2005 · complexity intermediate · version 6.0

In my development environment, I have several header files directories. I need these directories to be both in my path, and in my tags list.

To accomplish this I use the following Python based script:

set path=.,$_WINCEROOT/.,$_WINCEROOT/public/,$_WINCEROOT/public/common/oak/inc,$_WINCEROOT/public/common/ddk/inc,$_WINCEROOT/public/common/sdk/inc,$_WINCEROOT/private/cellcore/dtpt/inc
set tags=./tags,../tags,../inc/tags

function! BuildTagsFromPath()
python << EOF
import sys
import vim
paths = vim.eval("&path") # &path gets the option path.
pathsSplit = paths.split(",")

# prepend original tag list before path.
tags = vim.eval("&tags")
for path in pathsSplit:
  tags += "%s/tags," % (path)
cmdSetTags = "set tags=%s" % tags

call BuildTagsFromPath()


Also on Fandom

Random Wiki