Wikia

Vim Tips Wiki

Changes: Script:1868

Edit

Back to page

m (Perl support fix)
(adjust Template:ScriptComments to remove id as no longer needed; minor tweaks)
 
Line 1: Line 1:
{{ScriptComments|1868|simplefold : space-optimized, configurable folds}}
+
{{ScriptComments|simplefold: space-optimized, configurable folds}}
   
 
See [http://eigenclass.org/hiki/simplefold simplefold website].
 
See [http://eigenclass.org/hiki/simplefold simplefold website].
Line 6: Line 6:
 
===Perl support fix===
 
===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.
 
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.
 
 
<pre>
 
<pre>
 
" Perl support
 
" Perl support
Line 26: Line 25:
   
 
About the only thing that doesn’t work after this change is lines which both close and open a block, e.g.:
 
About the only thing that doesn’t work after this change is lines which both close and open a block, e.g.:
 
 
<pre>
 
<pre>
 
if (something) {
 
if (something) {
Line 32: Line 30:
 
} elsif (somethingelse) { #this doesn’t work
 
} elsif (somethingelse) { #this doesn’t work
 
otherstuff
 
otherstuff
}
+
}
 
</pre>
 
</pre>

Latest revision as of 07:34, November 15, 2011

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