improve tagbar for perl

Mon, 24 Oct 2016 11:41:16 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 24 Oct 2016 11:41:16 -0400
changeset 426
4fcad88dbe5f
parent 425
e23906d13a57
child 427
a3c0f8f6c100

improve tagbar for perl

.ctags file | annotate | diff | comparison | revisions
.vim/ctags/perl.cnf file | annotate | diff | comparison | revisions
.vimrc file | annotate | diff | comparison | revisions
--- a/.ctags
+++ b/.ctags
@@ -1,12 +1,27 @@
 --extra=+q
+--exclude=.git
+--exclude=.hg
 --exclude=*min.js
 
+--langmap=perl:+.pod
+--regex-perl=/with[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/w,role,roles/
+--regex-perl=/extends[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/
+--regex-perl=/use[ \t]+base[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/
+--regex-perl=/use[ \t]+parent[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/
+--regex-perl=/^[ \t]*use[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/u,use,uses/
+--regex-perl=/^[ \t]*require[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/r,require,requires/
+--regex-perl=/^[ \t]*has[ \t]+['"]*([A-Za-z_+][A-Za-z0-9_]+)['"]*[ \t]+/\1/a,attribute,attributes/
+--regex-perl=/^[ \t]*around[ \t]+['"]*([A-Za-z_][A-Za-z0-9_]+)['"]*[ \t]+/\1/x,around/
+--regex-perl=/^[ \t]*\*([A-Za-z_][A-Za-z0-9:_]+)[ \t]+=/\1/l,alias,aliases/
+--regex-perl=/^[ \t]*our[ \t]+([\$@%][A-Za-z_][A-Za-z0-9_]+)/\1/o,our,ours/
+--regex-perl=/use[ \t]+constant[ \t]+['"]*([A-Za-z_][A-Za-z0-9_]+)['" \t]*/\1/c,constants/
+--regex-perl=/^\=head1[ \t]+(.+)/\0/d,pod,Plain Old Documentation/
+--regex-perl=/^\=head2[ \t]+(.+)/-- \1/d,pod,Plain Old Documentation/
+--regex-perl=/^\=head[3-5][ \t]+(.+)/--- \1/d,pod,Plain Old Documentation/
+
 --regex-perl=/^\s*fun +([0-9a-zA-Z_]+) *[{(]/\1/s,subroutines/
 --regex-perl=/^\s*method +([0-9a-zA-Z_]+) *[{(]/\1/m,methods/
 --regex-perl=/(['"]?)([0-9a-zA-Z_]+)\1\s+(,|=>)\s+sub\s+[{(]/\2/s,subroutines/
---regex-perl=/^\s*extends\s+(['"])(.+)\1/\2/e,extends/
---regex-perl=/^\s*with\s+(['"])(.+)\1/\2/r,role/
---regex-perl=/^\s*has\s+['"]?([0-9a-zA-Z_]+)/\1/a,attributes/
 
 --langdef=Elixir
 --langmap=Elixir:.ex.exs
deleted file mode 100644
--- a/.vim/ctags/perl.cnf
+++ /dev/null
@@ -1,6 +0,0 @@
---regex-perl=/^\s*fun +([0-9a-zA-Z_]+) *[{(]/\1/s,subroutines/
---regex-perl=/^\s*method +([0-9a-zA-Z_]+) *[{(]/\1/m,methods/
---regex-perl=/(['"]?)([0-9a-zA-Z_]+)\1\s+(,|=>)\s+sub\s+[{(]/\2/s,subroutines/
---regex-perl=/^\s*extends\s+(['"])(.+)\1/\2/e,extends/
---regex-perl=/^\s*with\s+(['"])(.+)\1/\2/r,role/
---regex-perl=/^\s*has\s+['"]?([0-9a-zA-Z_]+)/\1/a,attributes/
--- a/.vimrc
+++ b/.vimrc
@@ -406,20 +406,26 @@ let g:tagbar_autofocus = 1
 let g:tagbar_compact = 1
 let g:tagbar_width = 30
 
+" adapted from https://gist.github.com/jbolila/7598018
 let g:tagbar_type_perl = {
+    \ 'ctagstype'   : 'Perl',
     \ 'kinds' : [
         \ 'p:packages:1:0',
+        \ 'u:uses:1:0',
+        \ 'r:requires:1:0',
         \ 'e:extends',
-        \ 'r:roles',
-        \ 'c:constants:0:0',
-        \ 'f:formats:0:0',
+        \ 'w:roles',
+        \ 'o:ours:1:0',
+        \ 'c:constants:1:0',
+        \ 'f:formats:1:0',
         \ 'a:attributes',
         \ 'm:methods',
         \ 's:subroutines',
-        \ 'l:labels',
+        \ 'x:around',
+        \ 'l:aliases',
+        \ 'd:pod:1:0',
     \ ],
-    \ 'deffile' : '$MYVIM/ctags/perl.cnf'
-\ }
+  \ }
 
 
 ">> Unite

mercurial