Generate ctags into central location for git super-projects and submodules, vim 'setlocal' helper combined with .git/hooks.
Vim script Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Generate ctags into central location for git super-projects and submodules, vim 'setlocal' helper combined with .git/hooks.



First, copy the custom git hooks to your template at .git_template/hooks:

mkdir -p ~/.git_template/hooks
cp contrib/hooks/* ~/.git_template/hooks

And set your .gitconfig (or .config/git/config) globally:

git config --global init.templatedir '~/.git_template'

Note: Git >=1.7.12 is in line with XDG, e.g. .config/git/template.

Then install this vim plugin using your favorite plugin manager, or copy tagabana.vim to your .vim/plugin/ directory and start hacking.


Git+ctags Work-flow

When you git init, your template hooks will be copied into the new repository. You can manually copy them into an existing git project. These hooks will generate the ctags files in your $XDG_CACHE_HOME/vim/tags/ folder every time you:

If the hooks are enabled in the current git config:

# local to a repo
git config hooks.ctags.enable true
# global config
git config --global hooks.ctags.enable true

Then, they will execute the main ctags generator script.

Ensure ~/.ctags Configuration

To set different ctags options, create yourself a ~/.ctags, I've included an example at contrib/example.ctags

Vim work-flow

When you open Vim the plugin will try to detect the working-directory of the git super-project or submodule, and tells Vim to use the generated ctags file in the central location. This also happens after creating or reading a file. Note: The plugin caches the tags location per-tab, so mixing different project files in the same tab won't work as expected. You can easily change this behaviour to act per-buffer by hacking on tagabana.vim.



Options you can set in your .vimrc to overwrite default behaviour.

Option Default Description
g:tagabana_tags_dir $XDG_CACHE_HOME/vim/tags/ Central directory for tags
g:tagabana_match_submodule 0 Match submodules as well?

Credits & Contribution

This plugin was developed by Rafael Bodill under the MIT License. Pull requests are welcome.