Vim Tips Wiki
(move in fixes from VimTip419)
 
Line 30: Line 30:
 
if (something) {
 
if (something) {
 
stuff
 
stuff
} elsif { #this doesn’t work
+
} elsif (somethingelse) { #this doesn’t work
 
otherstuff
 
otherstuff
 
}
 
}

Revision as of 01:43, 4 November 2010

Use this page to discuss script 1868 1868

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

See simplefold website.

Comments

Perl support fix

By default (with the latest 0.5 version at this writing), it doesn't handle a lot of folding cases for Perl properly, but if you replace the Perl support section of SimpleFold.vim with the lines below, it will handle nearly every case properly.

" Perl support
let g:perl_simplefold_expr =
    \ '\v(^\s*(package|use|sub)>\s)'
let g:perl_simplefold_nestable_end_expr =
    \ '\v^\s*(\}|\);|\)\};)' .
    \ '|\v\(\#\)\@<!\}$' .
    \ '|\v\(\#\)\@<!\}\s*#.*$'
let g:perl_simplefold_prefix =
    \ '\v^\s*(#.*)?$'
let g:perl_simplefold_nestable_start_expr =
    \ '\v^\s*((elsif|if|for|foreach|unless|while)>\s*.*\{$' .
    \ '|\v^\s*(elsif|if|for|foreach|unless|while)>\s*.*\{.*\#' .
    \ '|else\s*\{' .
    \ '|for(each)?>\s*my[^\(]+\s*\(.*\)\s*\{' .
    \ '|(my>|our>)?\s*[@%\$].*\($)'

About the only thing that doesn’t work after this change is lines which both close and open a block, e.g.:

if (something) {
    stuff
} elsif (somethingelse) {                 #this doesn’t work
   otherstuff
}