Wikia

Vim Tips Wiki

Script:1868

Talk0
1,610pages on
this wiki

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 vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

See simplefold website.

CommentsEdit

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

Around Wikia's network

Random Wiki