From owner-freebsd-questions@FreeBSD.ORG Sat Feb 11 20:27:28 2006 Return-Path: X-Original-To: questions@freebsd.org 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 2F12616A422 for ; Sat, 11 Feb 2006 20:27:28 +0000 (GMT) (envelope-from bill@celestial.com) Received: from mail.mi.celestial.com (dagney.celestial.com [192.136.111.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id 81F6243D4C for ; Sat, 11 Feb 2006 20:27:27 +0000 (GMT) (envelope-from bill@celestial.com) Received: from localhost (localhost [127.0.0.1]) by mail.mi.celestial.com (Postfix) with ESMTP id 943C41E538; Sat, 11 Feb 2006 12:27:26 -0800 (PST) Received: from mail.mi.celestial.com ([127.0.0.1]) by localhost (alexis.mi.celestial.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03441-01; Sat, 11 Feb 2006 12:27:26 -0800 (PST) Received: by mail.mi.celestial.com (Postfix, from userid 203) id C0DD01DEE3; Sat, 11 Feb 2006 12:27:25 -0800 (PST) Date: Sat, 11 Feb 2006 12:27:25 -0800 From: Bill Campbell To: questions@freebsd.org Message-ID: <20060211202725.GA2679@alexis.mi.celestial.com> Mail-Followup-To: questions@freebsd.org References: <20060211184600.GA85555@skytracker.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060211184600.GA85555@skytracker.ca> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: amavisd-new at mi.celestial.com Cc: Subject: Re: formatting text from within vi X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@celestial.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2006 20:27:28 -0000 On Sat, Feb 11, 2006, David Banning wrote: >I am familiar with the !}fmt used in vi to reformat a paragraph, but >I wondered how, or if it is possible to do more complex formatting. You can format any line or block of text in vi(m) by passing it through an arbitrary filter program. I have this line in my ~/.vimrc file which formats whatever paragraph the cursor is in by running through a script I wrote that formats its standard using ``groff -mm''. The ``{'' positions the cursor at the beginning of the paragraph and the ``!}'' says filter to the end of the paragraph. map {!}gfmt You can also type a command on a line, and execute it replacing the contents of the line with the output of the program. If I want to get copies of all my signature files containing the text ``democracy'' I could enter the following line, place the cursor somplace in that line, and press ``!!sh''. cat `grep -li democracy ~/.signature.*` Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 Those who profess to favor freedom, and yet depreciate agitation, are men who want rain without thunder and lightning. They want the ocean without the roar of its many waters. -- Frederick Douglass