From owner-freebsd-questions@FreeBSD.ORG Wed Oct 8 07:48:15 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B529D16A4B3 for ; Wed, 8 Oct 2003 07:48:15 -0700 (PDT) Received: from mf2.bredband.net (mf2.bredband.net [195.54.106.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id E322C43F85 for ; Wed, 8 Oct 2003 07:48:09 -0700 (PDT) (envelope-from peder.blom@bredband.net) Received: from Hecate.my.hell ([213.113.217.160]) by mf2.bredband.net with SMTP id <20031008144801.CGSW28253.mf2@Hecate.my.hell>; Wed, 8 Oct 2003 16:48:01 +0200 Date: Wed, 8 Oct 2003 16:47:50 +0200 From: Peder Blom To: Bryan Cassidy Message-Id: <20031008164750.758c0c2c.peder.blom@bredband.net> In-Reply-To: <20031008062245.7ea8c9b1.b_cassidy@bellsouth.net> References: <20031008062245.7ea8c9b1.b_cassidy@bellsouth.net> X-Mailer: Sylpheed version 0.9.6 (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: vi and wrap text X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2003 14:48:15 -0000 On Wed, 8 Oct 2003 06:22:45 -0500 Bryan Cassidy 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.)