zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: Paul Moore <gustav@morpheus.demon.co.uk>, zsh-workers@math.gatech.edu
Subject: Re: Line editor - "get word from history"
Date: Thu, 26 Nov 1998 09:47:47 +0100	[thread overview]
Message-ID: <9811260847.AA60580@ibmth.df.unipi.it> (raw)
In-Reply-To: "Paul Moore"'s message of "Wed, 25 Nov 1998 23:15:35 NFT." <19981125231534.A735@morpheus>

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-<complete>
> 
> 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 <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56100 Pisa, Italy


      reply	other threads:[~1998-11-26  9:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-25 23:15 Paul Moore
1998-11-26  8:47 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9811260847.AA60580@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=gustav@morpheus.demon.co.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).