From 7efda1826fc1d515c62a174131fd5d567330fe02 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Mon, 21 Apr 2008 01:35:35 -0500 Subject: handle method modifiers --- vimrc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/vimrc b/vimrc index fbb89dd..47aa533 100644 --- a/vimrc +++ b/vimrc @@ -209,10 +209,11 @@ endfunction function Perl_foldtext() let line = getline(v:foldstart) - let matches = matchlist(line, '^\s*sub \(\w\+\)') + let matches = matchlist(line, + \ '^\s*\(sub\|around\|before\|after\|guard\)\s*\(\w\+\)') if !empty(matches) let linenum = v:foldstart - let sub_type = 'sub' + let sub_type = matches[1] let params = [] while linenum <= v:foldend let linenum += 1 @@ -228,10 +229,16 @@ function Perl_foldtext() \ 'my\s*\(' . var . '\)\s*=\s*shift\%(\s*||\s*\(.\{-}\)\)\?;') if !empty(shift_line) if shift_line[1] == '$self' - let sub_type = 'method' + if sub_type == 'sub' + let sub_type = '' + endif + let sub_type .= ' method' elseif shift_line[1] == '$class' - let sub_type = 'static method' - else + if sub_type == 'sub' + let sub_type = '' + endif + let sub_type .= ' static method' + elseif shift_line[1] != '$orig' let arg = shift_line[1] " also catch default arguments if shift_line[2] != '' @@ -261,7 +268,7 @@ function Perl_foldtext() break endwhile - return Base_foldtext(sub_type . ' ' . matches[1] . + return Base_foldtext(sub_type . ' ' . matches[2] . \ '(' . join(params, ', ') . ')') endif -- cgit v1.2.3