TagBar plugin cannot be added using ctags

1.4k views Asked by At

I'm trying to get the vim TagBar plugin to work with groovy language. I'm running on a Debian Linux. I've installed exhuberant-ctags.

I've searched on the web and found those two sites:

So I created a ~/.ctags file containing

--langdef=groovy
--langmap=groovy:.groovy
--regex-groovy=/^[ \t][(private|public|protected) ( \t)][A-Za-z0-9<>]+[ \t]+([A-Za-z0-9]+)[ \t](.)[ \t]{/\1/f,function,functions/
--regex-groovy=/^[ \t]*def[ \t]+([A-Za-z0-9_]+)[ \t]\=[ \t]{/\1/f,function,functions/
--regex-groovy=/^[ \t]*private def[ \t]+([A-Za-z0-9_]+)[ \t]/\1/v,private,private variables/
--regex-groovy=/^[ \t]def[ \t]+([A-Za-z0-9_]+)[ \t]/\1/u,public,public variables/
--regex-groovy=/^[ \t][abstract ( \t)][(private|public) ( \t)]class[ \t]+([A-Za-z0-9_]+)[ \t]/\1/c,class,classes/
--regex-groovy=/^[ \t][abstract ( \t)][(private|public) ( \t)]enum[ \t]+([A-Za-z0-9_]+)[ \t]/\1/c,class,classes/

And I've added this at the end of my .vimrc file:

let g:tagbar_type_groovy = {
    \ 'ctagstype' : 'groovy',
    \ 'kinds'     : [
        \ 'p:package',
        \ 'c:class',
        \ 'i:interface',
        \ 'f:function',
        \ 'v:variables',
    \ ]
\ }

But when I restart vim and edit a file with a simple class, I don't see anything in tagbar. Just the first line "press for help".

Does anybody knows why I can't manage to have it work?

Thanks

1

There are 1 answers

0
Yann Moisan On

Be sure to run ctags, inside or outside of Vim. You must check than the generated tags file is correct.

In my .vimrc, I've created the following mapping :

map <F5> :!ctags -R 

to easily run ctags.