Date: Wed, 8 Oct 2003 16:47:50 +0200 From: Peder Blom <peder.blom@bredband.net> To: Bryan Cassidy <b_cassidy@bellsouth.net> Cc: freebsd-questions@freebsd.org Subject: Re: vi and wrap text Message-ID: <20031008164750.758c0c2c.peder.blom@bredband.net> In-Reply-To: <20031008062245.7ea8c9b1.b_cassidy@bellsouth.net> References: <20031008062245.7ea8c9b1.b_cassidy@bellsouth.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 8 Oct 2003 06:22:45 -0500 Bryan Cassidy <b_cassidy@bellsouth.net> wrote: > I want to know is there a way to wrap the text in vi? In emacs you can > just hit Esc+q and it will wrap the text. How about vi? I dont use emacs, but isn't Esc+q the command to rewrap text? I'm not aware of any such command in vi but instead you can invoke the external command fmt. To rewrap the whole text to 60 columns: :%!fmt 60 To rewrap the text between lines 50 to 100: :50,100!fmt 60 You can of course also set markers, say a and b, and then :'a,'b!fmt 60 Check man fmt! It is capable of doing other things you might find useful, like centering a piece of text. (Hint: other useful external commands that can be used to extend vi in this way includes expand, unexpand and awk, especially awk is very powerful for advanced text processing. You can also write your own shellscripts and programs, the possibilites are almost unlimited.)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031008164750.758c0c2c.peder.blom>