zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: Current history number in command line
Date: Sun, 12 Oct 2008 20:30:12 -0700	[thread overview]
Message-ID: <081012203012.ZM27768@torch.brasslantern.com> (raw)
In-Reply-To: <slrngf4p3c.r2h.joerg@alea.gnuu.de>

On Oct 12,  9:25pm, Joerg wrote:
}
} while searching the history with ^R, is it possible to get the number of
} the current history entry?

Not easily.

With an ordinary motion widget, you can write a wrapper that grabs the
value of HISTNO and puts it somewhere useful.  Simple example:

    up-line-or-history() {
      zle .up-line-or-history "$@"
      RPS1=$HISTNO
      zle reset-prompt
      zle -R
    }
    zle -N up-line-or-history

With history-incremental-search-*, you don't have this luxury, because
the input and display for the incremental pattern is handled entirely
inside the widget; there is no hook for resetting the prompt.

If you're feeling ambitious, Functions/Zle/history-pattern-search is a
good starting point; it's already manipulating HISTNO so it shouldn't
be hard to find a place to add a few lines to poke something into the
prompt.


      reply	other threads:[~2008-10-13  3:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-12 21:25 Jörg Sommer
2008-10-13  3:30 ` Bart Schaefer [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=081012203012.ZM27768@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).