From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11007 invoked from network); 4 Nov 2005 18:00:48 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Nov 2005 18:00:48 -0000 Received: (qmail 32906 invoked from network); 4 Nov 2005 18:00:42 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Nov 2005 18:00:42 -0000 Received: (qmail 25973 invoked by alias); 4 Nov 2005 18:00:34 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9639 Received: (qmail 25963 invoked from network); 4 Nov 2005 18:00:33 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Nov 2005 18:00:33 -0000 Received: (qmail 31773 invoked from network); 4 Nov 2005 18:00:33 -0000 Received: from cluster-c.mailcontrol.com (HELO rly10c.srv.mailcontrol.com) (168.143.177.190) by a.mx.sunsite.dk with SMTP; 4 Nov 2005 18:00:31 -0000 Received: from exchange03.csr.com (mailhost1.csr.com [81.105.217.43]) by rly10c.srv.mailcontrol.com (MailControl) with ESMTP id jA4I00Kh011400; Fri, 4 Nov 2005 18:00:26 GMT Received: from news01 ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 4 Nov 2005 18:02:51 +0000 Date: Fri, 4 Nov 2005 18:00:24 +0000 From: Peter Stephenson To: Ian Langworth Cc: zsh-users@sunsite.dk Subject: Re: Is there a delete-to-previous-slash key? Message-Id: <20051104180024.5db02beb.pws@csr.com> In-Reply-To: References: Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Nov 2005 18:02:51.0804 (UTC) FILETIME=[F92A45C0:01C5E169] X-Scanned-By: MailControl A-05-40-01 (www.mailcontrol.com) on 10.67.0.120 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Ian Langworth wrote: > I'd like to have a key that deletes leftwards from the cursor to the > previous occurrence of '/'. Does anyone have a snippet that does this > sort of thing, or shall I dig deeper into zle? The easiest way is temporarily not to allow / to be part of a word and use backward-delete-word: backward-delete-to-slash () { local WORDCHARS=${WORDCHARS//\//} zle .backward-delete-word } zle -N backward-delete-to-slash but if you really want to delete anything else in the way you can use something like: backward-delete-to-slash() { integer pos=$CURSOR while (( pos > 1 )); do if [[ $LBUFFER[--pos] = / ]]; then LBUFFER=${LBUFFER[1,pos]} return 0 fi done return 1 } zle -N backward-delete-to-slash That doesn't save it on the kill ring; I had hoped there would be some shorthand for "delete this and put it on the kill ring" but the only ways I can see are either to set the mark, or do it longhand with CUTBUFFER and killring, and I couldn't be bothered. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com