/ctags

Extended Rules to support Modern Perl in Exuberant Ctags

Primary LanguageShell

Extended Rules to support Modern Perl in Exuberant Ctags

This is my Exuberant Ctags (~/.ctags) file. I use it lately with Vim with the tagbar plugin. It can be used with many Text editors like Vim, Emacs, jEdit, Sublime Text, Atom...

For now it only contains some additional regular expressions to support more Perl symbols. Feel free to contribute by adding regular expressions or improving the existing ones! Pull requests are wellcome.

Usage

For generating tags file with ctags, just put the file in your $HOME folder.

To add the content of this file to your existing ~/.ctags file:

curl https://raw.githubusercontent.com/kberov/ctags/master/.ctags >> ~/.ctags

If you are using Atom, you don't need this file, because its content is already part of the symbols-view core package.

How to add support for new symbols?

http://ctags.sourceforge.net/

http://stackoverflow.com/questions/979359/vim-and-custom-tagging

https://ericjmritz.wordpress.com/2013/03/14/writing-custom-rules-for-exuberant-ctags/

Make it work with tagbar vim plugin

Add the following to your .vimrc. The tagbar plugin has to be used ofcourse.

let g:tagbar_type_perl = {
    \ 'ctagstype' : 'perl',
    \ 'kinds'     : [
        \ 'p:package:0:0',
        \ 'w:roles:0:0',
        \ 'e:extends:0:0',
        \ 'u:uses:0:0',
        \ 'r:requires:0:0',
        \ 'o:ours:0:0',
        \ 'a:properties:0:0',
        \ 'b:aliases:0:0',
        \ 'h:helpers:0:0',
        \ 's:subroutines:0:0',
        \ 'd:POD:1:0'
    \ ]
\ }

Another option is to use a specific script with tagbar. Put perl_ctags_for_tagbar from this repo into ~/bin/ and make sure it is executable.

" Settings to support extended patterns for perl in ctags in tagbar
let g:tagbar_type_perl = {
    \ 'ctagstype' : 'perl',
    \ 'kinds'     : [
        \ 'p:package:0:0',
        \ 'w:roles:0:0',
        \ 'e:extends:0:0',
        \ 'u:uses:0:0',
        \ 'r:requires:0:0',
        \ 'o:ours:0:0',
        \ 'a:properties:0:0',
        \ 'b:aliases:0:0',
        \ 'h:helpers:0:0',
        \ 's:subroutines:0:0',
        \ 'm:private_subroutines:0:0',
        \ 't:old_private_subroutines:0:0',
        \ 'd:POD:1:0'
    \ ],
	\ 'ctagsbin'  : 'perl_ctags_for_tagbar'
\ }

Bugs and limitations

POD after the END marker is not shown, but seems this is caused by ctags and I don't have an idea how to change it.

Author

Красимир Беров (2013--2018)