Vim Tips Wiki
(→‎Comments: asking questions)
(Remove temporary comment)
Line 27: Line 27:
   
 
==Comments==
 
==Comments==
 
I have tried this by copy pasting the commands and executing it as suggested.
 
However, it would seem that no folds were create. In any case, zM did nothing (and I had many empty lines in file).
 
 
Any advice?
 
 
:We don't encourage questions about using Vim on the wiki because they distract from the work of improving the tip collection. Of course, feel free to comment if you have questions about or see deficiencies in a tip, but please see [[Vim_Tips_Wiki:Community_Portal#Asking_questions|'''how to ask questions''']] about Vim itself. <small>This comment was added on 2008-04-24 and will be removed after a week.</small>[[Category:Temporary]]
 
 
:This tip works for me. See {{help|:syn-fold}} to see if anything jumps out at you. Or ask on vim_use. Note that if an entire match is on a single line, nothing will be folded (i.e. if none of your "many" blank lines occur consecutively, nothing will be folded).
 
 
:--[[User:Fritzophrenic|Fritzophrenic]] 16:09, 3 July 2008 (UTC)
 

Revision as of 05:21, 2 August 2008

Tip 399 Printable Monobook Previous Next

created January 13, 2003 · complexity basic · author Thomas · version 6.0


You can fold sequences of two or more empty lines (may contain whitespace) with these settings:

:syn match MyEmptyLines "\(^\s*\n\)\+" fold
:syn sync fromstart
:setlocal foldmethod=syntax

After entering the above, type zM to close all folds, or zR to open them.

If you have set 'foldcolumn' to more than 0 you can open/close the empty-line blocks by clicking the '+' or '-' with the mouse in the folder column.

See also

Comments