Skip to content

Commit a4a6088

Browse files
committed
Fixes #8. Improved handling of ( ) and [ ] folds.
Turns out Vim assumes the fold of a '=' line following a '<#' line is 1 less than the #, rather than that of the line before the '>#' line, i.e. the last known line.
1 parent 7a1b731 commit a4a6088

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

ftplugin/php/foldexpr.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ function! GetPhpFold(lnum)
134134
" But don't start a fold if we're grouping if/elseif/else and try/catch
135135
return IndentLevel(a:lnum)+1
136136
else
137-
return '>' . (IndentLevel(a:lnum)+1)
137+
return 'a1'
138138
endif
139-
elseif line =~? '\v^\s*[\(\[]*(\)|\])'
140-
return '<' . (IndentLevel(a:lnum)+1)
139+
elseif line =~? '\v^\s*([\(\[].*)@!(\)|\])'
140+
return 's1'
141141
endif
142142

143143
" Fold switch case and default blocks together

0 commit comments

Comments
 (0)