Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Current history number in command line
- X-seq: zsh-workers 25869
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Current history number in command line
- Date: Sun, 12 Oct 2008 20:30:12 -0700
- In-reply-to: <slrngf4p3c.r2h.joerg@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <slrngf4p3c.r2h.joerg@xxxxxxxxxxxx>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author