From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10812 invoked by alias); 29 Mar 2012 12:15:14 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16928 Received: (qmail 13869 invoked from network); 29 Mar 2012 12:15:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Thu, 29 Mar 2012 14:06:24 +0200 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: s/pattern/pattern/g on the commandline ? Message-ID: <20120329120624.GN9025@xvii.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20120225182450.GA31597@solfire> <20120227103844.1de5405d@pwslap01u.europe.root.pri> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20120227103844.1de5405d@pwslap01u.europe.root.pri> X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.21-6201-vl-r48020 (2011-12-20) This is a bit old, but... On 2012-02-27 10:38:44 +0000, Peter Stephenson wrote: > On Sat, 25 Feb 2012 19:24:50 +0100 > wrote: > > Is there any way to submit commands like > > 's///g' for being applied the whole commandline > > in one go? > > Just as a postscript, it's worth noting the ZLE widgets replace-string > (which can also be loaded under the names replace-pattern or > replace-regexp) and replace-string-again. This allows you to do this > interactively from the command line. See the zshcontrib manual page. > > I use > > > # actually autoloaded > zlewidget() { > # bindkey KEY to new WIDGET, possibly implemented by optional FUNCTION. > # FUNCTION defaults to WIDGET and will be marked for autoload -Uz. > > local key=$1 > local widget=$2 > local function=${3:-$2} > > autoload -Uz $function > zle -N $widget $function > bindkey $key $widget > } > zlewidget "\e%" replace-regexp replace-string But after such a replacement, if one wants to revert, "undo" doesn't work. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)