Wikia

Vim Tips Wiki

Changes: Fold away empty lines

Edit

Back to page

(Remove temporary comment)
(Change <tt> to <code>, perhaps also minor tweak.)
Line 3: Line 3:
 
|previous=398
 
|previous=398
 
|next=400
 
|next=400
|created=January 13, 2003
+
|created=2003
 
|complexity=basic
 
|complexity=basic
 
|author=Thomas
 
|author=Thomas
Line 19: Line 19:
 
</pre>
 
</pre>
   
After entering the above, type <tt>zM</tt> to close all folds, or <tt>zR</tt> to open them.
+
After entering the above, type <code>zM</code> to close all folds, or <code>zR</code> to open them.
   
If you have set '<tt>foldcolumn</tt>' to more than 0 you can open/close the empty-line blocks by clicking the '+' or '-' with the mouse in the folder column.
+
If you have set '<code>foldcolumn</code>' 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==
 
==See also==

Revision as of 05:28, July 13, 2012

Tip 399 Printable Monobook Previous Next

created 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

Around Wikia's network

Random Wiki