From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 757 invoked from network); 26 Nov 1998 09:12:42 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 26 Nov 1998 09:12:42 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id EAA20816; Thu, 26 Nov 1998 04:05:43 -0500 (EST) Resent-Date: Thu, 26 Nov 1998 04:05:43 -0500 (EST) Message-Id: <9811260847.AA60580@ibmth.df.unipi.it> To: Paul Moore , zsh-workers@math.gatech.edu Subject: Re: Line editor - "get word from history" In-Reply-To: "Paul Moore"'s message of "Wed, 25 Nov 1998 23:15:35 NFT." <19981125231534.A735@morpheus> Date: Thu, 26 Nov 1998 09:47:47 +0100 From: Peter Stephenson Resent-Message-ID: <"I_Dtn.0.B55.cdHNs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4689 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Paul Moore wrote: > I was reading an article on the WWW recently, which compared various > shells. One feature of tcsh which was commented on favourably was the > history stuff. Two particular features I liked: > > 1. A keypress to move to a previous history line which matched what you > had typed so far on the line. Zsh has this, in history-beginning-search- > backward (although I'd prefer this if it moved the cursor to the end of > the line, but retained knowledge of the part I had typed, so that I > could continue backwards matching what I had typed, or stop and add to > the end of the line). There's a long and involved story to this. The end of the story is that zsh had this, but it was removed because it seemed to be one too many special cases in the Zle code. The dust has not yet quite settled. Frankly, having seen all the discussion, I think the path of least resistance is to put it back in some form. Having converted myself, I can say, however, that when you get used to it not going to the end of the line you may wonder why you ever wanted it to. > 2. A keypress to complete the current word, using the words in previous > history lines - imagine > mkdir a-very-long-name > cd a- > > I looked in the zsh documentation I have (not totally up-to-date) and > could find nothing like (2). Is it available in the latest version, and > if not, is there any chance of it being added? It's not there as such in an official version yet, but there are two notes to be made (three notes to be made, among the notes to be made are): 1. there are better ways of completing directory names in both tcsh and zsh, but I presume that was just a random example. 2. you can in all recent zsh add history matching to default completion (or any other sort) by sticking + -H 0 '' on the end, e.g. (simplest case): compctl -D -f + -H 0 '' so if it doesn't find a file it'll search the history list. 3. there is a patch which allows you to bind arbitrary completions to particular keys. If you're desperate to try it, there's an unofficial (and definitely beta, though apparently usable) version which contains it which you can get at http://www.ifh.de/~pws/computing/zsh-3.1.5-patched.tar.gz . Then the incantation is zle -C history-complete-word -H 0 '' bindkey "your-favourite-key-sequence" history-complete-word This method works for any set of completions, not just history. The semantics may change if this patch becomes official. -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56100 Pisa, Italy