From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16535 invoked from network); 3 Nov 2008 12:56:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) 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.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 Nov 2008 12:56:50 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 51024 invoked from network); 3 Nov 2008 12:56:43 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Nov 2008 12:56:43 -0000 Received: (qmail 7392 invoked by alias); 3 Nov 2008 12:56:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25994 Received: (qmail 7373 invoked from network); 3 Nov 2008 12:56:34 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 3 Nov 2008 12:56:34 -0000 Received: from mail.o2.co.uk (sidious.london.02.net [82.132.130.152]) by bifrost.dotsrc.org (Postfix) with ESMTP id 25CAB80524C0 for ; Mon, 3 Nov 2008 13:56:27 +0100 (CET) Received: from sc.homeunix.net (78.105.216.138) by mail.o2.co.uk (8.0.013.3) (authenticated as stephane.chazelas) id 490AECBD00BFC43F; Mon, 3 Nov 2008 12:56:10 +0000 Received: from chazelas by sc.homeunix.net with local (Exim 4.69) (envelope-from ) id 1KwyyX-0002Vd-NN; Mon, 03 Nov 2008 12:56:09 +0000 Date: Mon, 3 Nov 2008 12:56:09 +0000 From: Stephane Chazelas To: Peter Stephenson Cc: Matthieu Louvel de Monceaux , zsh-workers@sunsite.dk Subject: Re: Weird Vi-mode behavior Message-ID: <20081103125609.GA4855@sc.homeunix.net> Mail-Followup-To: Peter Stephenson , Matthieu Louvel de Monceaux , zsh-workers@sunsite.dk References: <490EED78.8010802@gmail.com> <200811031237.mA3Cb2VS013961@news01.csr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200811031237.mA3Cb2VS013961@news01.csr.com> User-Agent: Mutt/1.5.16 (2007-09-19) X-Virus-Scanned: ClamAV 0.92.1/8557/Mon Nov 3 12:44:31 2008 on bifrost X-Virus-Status: Clean On Mon, Nov 03, 2008 at 12:37:02PM +0000, Peter Stephenson wrote: > Matthieu Louvel de Monceaux wrote: > > When we return from command mode to insert mode, we can't modify > > the text from the beginning to the spot where we got insert ... > > Definitely a weird behavior ... > > > > To get it too, just type 'foo folk x' for example. > > Then Esc, type 'b' to go to the previous word, then press 'i' to go > > insert mode. > > Now you can't edit the 'foo ' part anymore. > > I'm sorry, I don't understand. [...] I suspect he is refering to the traditional vi behavior of vi-backward-delete-char documented in "info zsh 'Modifying Text'" vi-backward-delete-char (unbound) (X) (^H) Delete the character behind the cursor, without changing lines. If in insert mode, this won't delete past the point where insert mode was last entered. So I suspects he wants instead: if (($+terminfo[kbs])); then bindkey -M viins $terminfo[kbs] backward-delete-char else bindkey -M viins '^?' backward-delete-char bindkey -M viins '^H' backward-delete-char fi (($+terminfo[kdch1])) && bindkey -M viins $terminfo[kdch1] delete-char The above trys to map the emacs-style (as opposed to vi style) backward-delete-char to the character sent by the backspace key (using the terminfo database if it's there, or hardcoding both ^? and ^H). It also maps delete-char to the character sent by the delete key if the terminfo database has that information. Note that on a number of terminals, backspace sends ^H and delete ^? while in a number of others backspace sends ^? and delete something else like the sequence \e[3~ -- Stéphane