From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.6/8.7.3) with ESMTP id EAA13665 for ; Wed, 27 Nov 1996 04:55:23 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id MAA20454; Tue, 26 Nov 1996 12:32:16 -0500 (EST) Resent-Date: Tue, 26 Nov 1996 12:32:16 -0500 (EST) Date: Tue, 26 Nov 1996 09:33:01 -0800 (PST) From: Bart Schaefer Message-Id: <961126093403.ZM5050655@srf-59.nbn.com> In-Reply-To: Zefram "Re: Vi insert-mode cursor key bindings." (Nov 26, 12:53pm) References: <19984.199611261253@stone.dcs.warwick.ac.uk> reply-to: schaefer@brasslantern.com X-Mailer: Z-Mail for Macintosh (3.3.1 27Mar96) To: zsh-workers@math.gatech.edu Subject: Re: Vi insert-mode cursor key bindings. Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"RPozZ2.0.W_4.Vcoco"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2487 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Nov 26, 12:53pm, Zefram wrote: > Subject: Re: Vi insert-mode cursor key bindings. > >These last two statements seem to contradict the first. If an ESC-prefix > >will interfere with the command "ESC", then how then does it "work > >as expected"? Or if it "works as expected", how does it interfere? > > The cursor keys will then work, but if you press there will be a > delay, while zsh waits for the rest of an escape sequence, before > vi-cmd-mode gets executed. I am of the opinion that key-generated > escape sequences are a bad idea in general, for this reason. That's only bad if striking another key while zsh is waiting causes the wrong thing to happen. For example, if ESC is a prefix but ESC k is not bound to anything, and I rapidly type ESC k, does zsh drop into vi-cmd-mode and move up a line? Or does it feep because it has interpreted ESC k as a sequence? I use the "evi" Emacs vi emulator [*] quite a bit; it had this problem for quite a while. > One better: I don't use cursor keys at all. Their behaviour is too > inconsistent to rely on them. (The terminals that I regularly use > don't generate ANSI escape sequences, so they wouldn't work in ZLE.) But they do generate some kind of escape sequence, right? If we're going to add default bindings for the cursor keys, we should do it right -- we should read the term{cap,info} database and add the binding for what it says the arrow keys generate, not just hardwire to the vt100/ANSI sequences. (Most vi that I've used actually map both the ANSI and terminfo arrow keys, though not in insert mode.) A further comment: The reason for binding cursor keys in insert mode in vi is typically *not* so that the user can navigate without leaving insert mode (though I can't speak for nvi's reasons). The reason is best illustrated by considering what happens if you're navigating in command mode on a slow or unreliable link. You're holding down the cursor key to scroll up or down the page, generating a stream of bytes ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A .... On a slow line, you can generate around 100 key-presses of typeahead pretty easily. Now think about what happens when the line drops just one of those ESC characters. > >If I can bind them manually - without messing up "esc" on it's own - > >then I'm content. > > you *can* bind them manually if you want them, so I think we should > default to the better vi emulation. I agree with Zefram about vi-insert-mode, but I do think we should add the terminfo-obtained bindings anywhere that zsh already has the ANSI bindings. That doesn't always work either, but at least we'll get it right a bit more often. [*] Evi is a more faithful emulation of vi than either vip or viper, in spite of a couple small bugs. I'm annoyed by the way vip and viper try to "improve" on vi by e.g. redefining the way region movements work; a lot of my editing habits rely on the "inferior" vi behaviors, and if I wanted to change my editing habits I wouldn't be using a vi emulator in the first place. To answer the other obvious question: I need emacs for GNATS access and ediff-revisions.