Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

Taggatron

A simple tag file manager for Vim

Are you managing your tag files manually? Are you constantly trying to recall the right command line arguments for ctags-exuberant? Would you like a very light tag manager to solve your problems? Look no further.

Taggatron allows you to set up rules for creating your tag files, based on the language. It separates tag files for different languages (I decided this was the way I wanted to go, as it is neater and easier to maintain), and incorporates the Autotag script by Craig Emery to update tag files incrementally as you edit your files.

Quick start

You specify rules for your tag files using a dictionary, as so:

let g:tagcommands = {
\    "php" : {"tagfile":".php.tags","args":"-R"},
\    "javascript" : {"tagfile":".js.tags","args":"-R"} 
\}

As you can see, each entry has a key which is the language you want to generate tags for (only those supported by exuberant ctags). There are several configuration options for each tag file:

let g:tagcommands = {
\    "php" : {
\        "tagfile" : ".php.tags",   " Location of the tag file
\        "args" : "-R",   " Arguments to pass to the command (-f and --languages are added automatically)
\        "cmd" : "ctags-exuberant",   " Command to execute
\        "filesappend" : "**"   " This is appended to the current working directory, and used as the files argument
\    }
\}

Now, when you write a file whose language has a tag file configuration, a tag file will be automatically generated. If it exists, it will be updated. To force re-creation of the tag file, run:

:TagUpdate

Note: this script works well if you want to use multiple configurations, like a project-style set-up. I have a script that does something like that, called vim-sauce.

Examples

Create tags for all files matching the language in and below the current directory:

let g:tagcommands = {
\    "php" : {
\        "tagfile" : ".php.tags",
\        "args" : "-R"
\    }
\}

Create tags for all files matching the language in a sub-directory of the current one:

let g:tagcommands = {
\    "php" : {
\        "tagfile" : "sub/directory/php.tags",
\        "args" : "-R",
\        "filesappend" : "sub/directory/**"
\    }
\}

Create tags for all files matching the language using an absolute directory:

let g:tagcommands = {
\    "php" : {
\        "tagfile" : "/path/to/directory/php.tags",
\        "args" : "-R",
\        "files" : "/path/to/directory/**"
\    }
\}

Configuration

Along with specifying the commands for generating the tag files, you can specify default tag files to use alongside the ones generated by taggatron, e.g. if you have separate tag files for core libraries:

let g:tagdefaults = "/path/to/other/tag.file"

If you're having trouble, put the script into debug mode to see what's going on:

let g:taggatron_verbose = 1

Acknowledgements

My thanks goes to Craig Emery for his Autotag script, which I've modified slightly to fit with my script.

License

This is released under the MIT license.

About

Tag file manager for Vim

Resources

License

Releases

No releases published

Packages

No packages published