Syntax based folding can be enabled by adding the following lines to the file '~/.vim/syntax/perl.vim': let perl_fold=1 let perl_fold_blocks=1 #### s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)