From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3833 invoked from network); 16 Mar 2004 13:37:34 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 16 Mar 2004 13:37:34 -0000 Received: (qmail 12870 invoked by alias); 16 Mar 2004 13:37:12 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7187 Received: (qmail 12836 invoked from network); 16 Mar 2004 13:37:11 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 16 Mar 2004 13:37:11 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.58.19] by sunsite.dk (MessageWall 1.0.8) with SMTP; 16 Mar 2004 13:37:11 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i2GDbAv10360 for ; Tue, 16 Mar 2004 13:37:10 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Tue, 16 Mar 2004 11:27:33 +0000 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 16 Mar 2004 11:30:06 +0000 To: zsh-users@sunsite.dk Subject: Re: Word component characters -- how to have two behaviors? In-reply-to: "Kai Grossjohann"'s message of "Tue, 16 Mar 2004 10:51:36 +0100." <878yi1jf13.fsf@emptyhost.emptydomain.de> Date: Tue, 16 Mar 2004 11:27:54 +0000 Message-ID: <11963.1079436474@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 16 Mar 2004 11:30:06.0566 (UTC) FILETIME=[0829D060:01C40B4A] Kai Grossjohann wrote: > kai-forward-word () { > select-word-style shell; zle forward-word; select-word-style bash; > } > zle -N kai-forward-word kai-forward-word > bindkey "\eF" kai-forward-word > > Is there a more elegant way to do this? Yes, this is what styles are for. The current syntax is: zle -N kai-forward-word forward-word-match bindkey '\eF' kai-forward-word zstyle ':zle:kai-forward-word' word-style shell This creates and binds a new widget implemented by the same function as the version of forward-word used when the word-style mechanism is in effect. `zle -lL | grep forward-word' would give you that information. Then you set a style specifically for the new widget you created. Any of the styles described in zshcontrib for the *-match functions work. As you can see, it's much neater because it's all done with names; there's no new code. It resembles a number of clever tricks in the completion system (not coincidentally). Actually, I've been thinking about extending the mechanism (there was a discussion a while ago but no one responded), so it might be safer to use zstyle ':zle:kai-forward-word(:*|)' in case I add extra colon-delimited arguments. (You can just about work this out, except that last suggestion, from a combination of the zshzle, zshcontrib and zshutil manual pages, but it's tough going. I should add something like this as an example.) -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************