summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-04-21 01:35:35 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-04-21 01:35:35 -0500
commit7efda1826fc1d515c62a174131fd5d567330fe02 (patch)
tree6f9af2fcbb640c10af891606331deebea65b05e8
parent6f3910c666ddd92d09cc5551f776a82f6c0d4e63 (diff)
downloadvim-foldtext-7efda1826fc1d515c62a174131fd5d567330fe02.tar.gz
vim-foldtext-7efda1826fc1d515c62a174131fd5d567330fe02.zip
handle method modifiers
-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