Wikia

Vim Tips Wiki

Changes: Format only long lines

Edit

Back to page

(change "anon" author to blank; trim "created" date; minor manual clean)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 24: Line 24:
   
 
==Comments==
 
==Comments==
How is this better than <tt>gq</tt> with a line width of 80?
+
How is this better than <code>gq</code> with a line width of 80?
   
 
----
 
----

Latest revision as of 06:08, July 13, 2012

Tip 1131 Printable Monobook Previous Next

created 2006 · complexity basic · version 6.0


You want to format/wrap long lines, but not touch shorter lines.

Example: For each line longer than 80 chars, run that line thru the par text formatter.

:g/.\{80,\}/ .!par w70

This need arises when you cut/paste a programming snippet from your web browser into Vim, and you want to leave the indented code alone, but format the long explanation.

See VimTip584, on the capabilities of par.

CommentsEdit

How is this better than gq with a line width of 80?


Around Wikia's network

Random Wiki