| Vim-Tag documentation | view source | Contained in the Vim-Tag distribution. |
Vim::Tag - Generate perl tags for vim
version 1.110690
$ ptags --use ~/code/coderepos -o ~/.ptags
In .vimrc:
set tags+=~/.ptags
then this works in vim:
:ta Foo::Bar
:ta my_subroutine
bash completion:
cpanm Bash::Completion::Plugins::VimTag
alias vit='vi -t'
then you can do:
$ vit Foo::Bar
$ vit my_subroutine
Custom tag generation
package Foo::Bar;
$::PTAGS && $::PTAGS->add_tag($tag, $filename, $line);
Manage tags for perl code in vim, with ideas on integrating tags with the bash programmable completion project. See the synopsis.
You should subclass this class to use it in your ptags-generating
application. It could be as simple as that:
#!/usr/bin/env perl
use warnings;
use strict;
use base qw(Vim::Tag);
main->new->run;
And if you want just that, there's the ptags program. But it is more
interesting to extend this with custom aliases and to have your modules
generate custom tags and so on. The documentation on those features is a bit
sparse at the moment, but take a look in this distribution's examples/
directory.
Takes a tag name, a filename and a 'search' argument that can either be a line
number which caused the tag, or a vim search pattern which will jump to the
tag. It will add the tag to the tags hash.
Determines which directories should be searched. This includes all of @INC
and anything set via --libs. We also weed out nested directories. For
example, @INC might contain
/.../perl-5.12.2/lib/5.12.2/darwin-2level
/.../perl-5.12.2/lib/5.12.2
Then we don't want the first one, but we do want the second one.
We go through library directories in @INC order. I assume that
custom directories will be unshift()-tacked onto @INC so they
come first - this happens with use lib, for example. That means
that the main perl libraries will come last. By going through the
libraries in reverse order, a local version of a module will take
precedence over a module that's installed system-wide. This is useful
if you have a module both under development in your $PROJROOT as
well as installed system-wide; in this case you most likely want tags
to point to the locally installed version.
Finalizes things just before the tags are written. Here we just very
specifically avoid END{} processing when Test::Base has been
loaded.
Makes a tag for a given package.
Takes a list of regex/replace pairs and applies each pair to each tag
name. If the name has been changed by the s/// operation, a new tag
is recorded.
It's not used directly in this class or in ptags, but if you write
a custom tags generator you might want to munge the results. For
example, you might want to make alias tags for long package names.
Instead of My::Very::Long::Package::Namespace::* you might like to
have mvlpn::* tags.
Processes the given .pm file.
Processes the given .pod file.
The main method that calls the other methods to do its work. This is
the method your tag generator - for example, ptags - will call.
If you use --use and the packages load modules which can't be loaded easily
in the context of Vim::Tag or which have some side-effects, you can act as
though that module has already been loaded.
This method takes a list of package names and changes @INC for each one.
It's not used directly in this class or in ptags, but if you write a custom
tags generator you might need to use it.
See perlmodinstall for information and options on installing Perl modules.
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Vim-Tag.
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Vim-Tag/.
The development version lives at http://github.com/hanekomu/Vim-Tag and may be cloned from git://github.com/hanekomu/Vim-Tag.git. Instead of sending patches, please fork this project using the standard git and github infrastructure.
Marcel Gruenauer <marcel@cpan.org>
This software is copyright (c) 2008 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| Vim-Tag documentation | view source | Contained in the Vim-Tag distribution. |