How to group subroutines with packages in vim tagbar for perl?

206 views Asked by At

For some time I have been using perl with vim now. Before that I used IntelliJ with a plugin for perl. The only thing that I am missing is a different view in vim tagbar. I have configured it to run with universal ctags and it shows me categories for packages, subroutines and constants. But with an example script file that has three packages where each package has a create() method those methods all show up under the category "Subroutines". And the package names all show up underneath "Packages". That's it. This is a very flat view.

What I would like to have is (in addition or as a replacement) a tree view where I have all the methods belonging to a package attached to it. But I could not get it to work so far :-( I would appreciate any ideas on how I have to configure tagbar to get a more tree-like view in Perl.

1

There are 1 answers

1
gregory On

I believe your tags are not being fully qualified, which leads to seeing everything as flat. You should be generating your perl tags with the --extra=q flag; for example:

ctags -f tags --recurse --totals \ 
--exclude=blib --exclude=.svn \ 
--exclude=.git --exclude='*~' \ 
--extra=q \ 
--languages=Perl \ 
--langmap=Perl:+.t

Also, make sure to add a colon to the list of keyword chars in your .vimrc, so you can do completion on Module::Names:

set iskeyword+=:

Note: I haven't used universal ctags yet, so I can't confirm this is your issue but I did check their documentation (http://docs.ctags.io/en/latest/news.html?highlight=extra%3Dq) and this flag is still used and NOT on by default.