summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vimrc19
1 files 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