Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 37 lines (23 sloc) 4.744 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
This is a mirror of http://www.vim.org/scripts/script.php?script_id=4253

Beware: this is a wrapping script over plugin TagHighlight. Hopefully its functionality will eventually appear in TagHighlight.

This plugin is capable of managing both tag jumps and highlights databases simultaneously for different projects. It consists of two standalone applications BuildTags and MakeVimHlTags and this file. To manage tag highlights it uses excellent plugin TagHighlight (http://www.vim.org/scripts/script.php?script_id=2646) as backend. The plugin also needs exuberant ctags and (optionally) cscope packages.

TagManager can manage both jumps and highlights tags incrementally, it means that projects may depend on other projects and user can setup his projects in such a way that he would need to update only small pieces of tags databases related to changes he would have made for a small project: all not changed dependencies would not be rebuilt and would be attached to the small projects as is. For example user can manage a small project my_proj which depends on large 3rd-party libraries libLarge1 and libLarge2 that he would definitely never change (we denote this sort of dependency as my_proj:libLarge1,libLarge2), then when he decide to update the tags of the project my_proj, tags from libLarge1 and libLarge2 will be attached to those from my_proj not having been rebuilt.

The plugin provides 3 commands:

    UpdateProjectJumps
    UpdateProjectHighlights
    UpdateProjectTags

Normally you will need only UpdateProjectTags which is a simple sequence of the first two. Issuing :UpdateProjectTags will update both jumps and highlights tags in the project you are currently in.

To use the plugin efficiently add following lines in your .vimrc:

    if !exists('g:TagHighlightSettings')
        let g:TagHighlightSettings = {}
    endif
    let g:TagHighlightSettings['LanguageDetectionMethods'] =
                                            \ ['Extension', 'FileType']
    let g:TagHighlightSettings['FileTypeLanguageOverrides'] =
                                            \ {'svn': 'c', 'tagbar': 'c'}
    let g:loaded_TagHighlight = 2

Setting variable g:TagHighlightSettings['FileTypeLanguageOverrides'] will let you enjoy tag highlights in tagbar window and when committed svn changes. Line 'let g:loaded_TagHighlight = 2' will prevent loading of TagHighlight before TagManager thus letting the latter to manage initialization of the former itself. This is important because TagManager depends on TagHighlight plugin and autocommands from TagManager must go before corresponding autocommands from TagHighlight. Value 2 will make TagManager aware that variable g:loaded_TagHighlight was only initialized in .vimrc and TagHighlight is really not loaded yet.

You also may want to put scripts BuildTags and MakeVimHlTags in some directory listed in your $PATH environment variable (by default this plugin expects to find them in $HOME/bin/), and create new environment variable $TAGSDIR where all plugin data will be saved. Now you can additionally use BuildTags and MakeVimHlTags as standalone scripts and create tags for vim directly from command line. To see available command-line options run the scripts with option --help.

By default plugin reads configuration file $HOME/.vim-TagManager.conf where a user defines settings for building and updating tags for his projects. Each line in the configuration file corresponds to one project and consists of 5 columns, separated with double semicolon (possibly surrounded by spaces or tabs). The first column is a directory match pattern used to define where the project resides, second column - name of the project with optionally appended (after colon) comma-separated list of other projects upon which this project depends, third column - language for building tag highlights (for example 'c' or 'python'), if user do not want to specify any language (i.e. highlights tags will be built for any languages that TagHighlight supports) then he can put in this column special placeholder - exclamation sign (!) which denotes empty value, fourth column - root directory for building jumps and highlights tags, fifth column - options for MakeVimHlTags, to see them run

    MakeVimHlTags --help

in command line. Please make sure that you understand the difference between values in column 1 and column 4: the former will be used in autocommands for finding out if specific directory matches project directory pattern and thus may contain glob symbols like '*' or '?', whereas the latter denotes the root directory for building tags. Values in any column may refer to environment variables: they will be expanded. An example of configuration file is shipped with this distribution.
Something went wrong with that request. Please try again.