[lug] Wrapping lines of text in VIM

Chip Atkinson chip at pupman.com
Thu Sep 16 16:35:31 MDT 2004

You can use fmt from within vim to format all or some of your text.  For
example, :1,$!fmt will run all the lines in the file through fmt.  You can
use the -w option to make it 65 wide too:
:1,$!fmt -w 65

Vim is a normal text editor (unless you like emacs, in which case it is
unnatural). It does indeed put carriage return characters at the end of
the lines.  If you wish to have "soft" carriage returns, you might wish to
look at word processors such as kedit or something.


On Thu, 16 Sep 2004, 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.
> Is there any way to set up vi so it wraps existing and new long lines at
> about column 65 and uses soft carriage returns? Or is asking vi to behave
> like a normal editor more than it can handle?
> - Bill Thoen
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug

More information about the LUG mailing list