sponsor Vim development Vim logo Vim Book Ad

projtags.vim : Set tags file for per project

 script karma  Rating 24/9, Downloaded by 3698  Comments, bugs, improvements  Vim wiki

created by
Yuxuan Wang
script type

Set your projects path into g:ProjTags as a list, for example:

let g:ProjTags = [ "~/work/proj1" ]

In this case for all file match the pattern "~/work/proj1/*", the tag file
"~/work/proj1/tags" will be used.

You can also specify a tags file other than the default one or more tags
files for one directory by a list:

let g:ProjTags += [[ "~/work/proj2", "~/work/proj2/tags",
"~/work/common.tags" ]]

In this case for all files match the pattern "~/work/proj2/*", the tag files
"~/work/proj2/tags" and "~/work/common.tags" will be used.

If one of the items in the list begins with ":", it will be treated as a
command (other than tag file):

let g:ProjTags += [[ "~/work/proj3", "~/work/proj3/tags",
":set shiftwidth=4" ]]

In this case for all files match the pattern "~/work/proj3/*", the tag file
"~/work/proj3/tags" will be used, and "shiftwidth=4" will be set.

Please note that if you use "set" in the command, we will actually use
"setlocal" instead, to avoid polluting the whole vim environment.

You can add the above codes into your vimrc file.

Git repository at https://github.com/fishy/projtags-vim

Google+ page at https://plus.google.com/100558470596894261435
install details
put this file under your ~/.vim/plugin/

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
projtags.vim 0.42 2013-01-10 7.0 Yuxuan Wang + added missing "let" thanks to Adam!
projtags.vim 0.41 2010-11-10 7.0 Yuxuan Wang * a serious bug regarding the return value of match() fixed thanks to ramp!
projtags.vim 0.4 2010-03-02 6.0 Yuxuan Wang + can handle directories end with "/" now
projtags.vim 0.3 2009-07-31 6.0 Yuxuan Wang + can add commands now
projtags.vim 0.2 2007-04-25 6.0 Yuxuan Wang + more tags file for one directory support (contributed by Joseph Barker)
+ check for g:ProjTags before use it
projtags.vim 0.1 2007-04-24 6.0 Yuxuan Wang Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.