2

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

4

1 回答 1

1

确保在 Vim 内部或外部运行 ctags。您必须检查生成的标签文件是否正确。

在我的 .vimrc 中,我创建了以下映射:

map <F5> :!ctags -R 

轻松运行 ctags。

于 2013-10-18T09:42:35.880 回答