[lug] Wrapping lines of text in VIM

Zan Lynx zlynx at acm.org
Thu Sep 16 16:35:19 MDT 2004


On Thu, 2004-09-16 at 16:09, Bill Thoen wrote:
> I have a text file that has fairly long lines and I'd to get them to wrap
> at about column 65. I'm using vi (vim, actually), and I set textwidth=0,
> wrapmargin=15 and wrap. With these settings, the new lines I add do wrap
> in the right place, but the existing ones don't unless I break each one
> manually.  Also these settings result in hard carriage returns.

Vi only does hard carriage returns (to my knowledge.)  The wrap and
wrapmargin settings do not appear to be related.  It looks like
wrapmargin is old Vi compatible.  Vim can use textwidth instead.  Both
textwidth and wrapmargin affect editing and cause Vim to insert carriage
returns at the ends of lines.  The wrap setting only controls how Vim
displays extra long lines.

Vim does many interesting things with the 'formatoptions' variable.  Try
":help formatoptions" for more info on that.  You might also look at
":help auto-format"

Outside of Vim there is the command-line "fmt" program that you might
find helpful.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20040916/2b96c249/attachment.pgp>


More information about the LUG mailing list