David Golden wrote:
As a vim user, I found it helpful to edit my perl.vim syntax file like so:

  " Use only the bare minimum of rules
- if exists("perl_fold")
+ if exists("perl_fold_pod")
    syn region perlPOD start="^=[a-z]" end="^=cut" fold
  else
    syn region perlPOD start="^=[a-z]" end="^=cut"
  endif

Then, by setting "let perl_fold_pod=1" in my .vimrc, all the pod folds up by default, leaving only code. (I don't fold my code, so folding just hides my inline pod. If you want to fold both, don't make the edit to perl.vim and set "let perl_fold=1") When I want to edit a folded pod section, "zo" opens a fold and "zc" closes it. "zn" opens them all and "zN" closes them all. Makes inline pod less frustrating, particularly if you write lengthy docs.

Thanks, I also use vim, so this works for me. :-) I had tried vim folding before and found it too complicated, but for this simplified use it's pretty nice.

Just one comment for our readers: the patch you gave was not enough by itself; I found that I also needed to set foldmethod; adding these lines to perl.vim seems to do the trick:

@@ -397,6 +398,9 @@

   setlocal foldmethod=syntax
   syn sync fromstart
+elseif exists("perl_fold_pod")
+  setlocal foldmethod=syntax
+  syn sync fromstart
 else
   " fromstart above seems to set minlines even if perl_fold is not set.
   syn sync minlines=0

Also, after looking at the docs, I think I'll use za instead of zo/zc and zi instead of zn/zN. But, with vim as with Perl, TMTOWTDI, so YMMV.

Ivan

Reply via email to