Tags: Visual edit apiedit |
(→Comments: mention formatprg option) Tag: sourceedit |
||
Line 27: | Line 27: | ||
----This IS better than gq with a line width of 80 because it prevents short lines without empty line between them from being concatenated! |
----This IS better than gq with a line width of 80 because it prevents short lines without empty line between them from being concatenated! |
||
+ | |||
+ | :See {{help|'formatprg'}}. You could probably get the best of both worlds. --[[User:Fritzophrenic|Fritzophrenic]] ([[User talk:Fritzophrenic|talk]]) |
Revision as of 15:42, 3 February 2016
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.
Comments
How is this better than gq
with a line width of 80?
This IS better than gq with a line width of 80 because it prevents short lines without empty line between them from being concatenated!
- See :help 'formatprg'. You could probably get the best of both worlds. --Fritzophrenic (talk)