Vim Tips Wiki


1,624pages on
this wiki
Add New Page

Use this page to discuss script 1868 simplefold: space-optimized, configurable folds

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

See simplefold website.


Perl support fixEdit

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) {
} elsif (somethingelse) {                 #this doesn’t work

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki