Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bash-like PgUp/PdDown reverse search?
- X-seq: zsh-users 11797
- From: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: Bash-like PgUp/PdDown reverse search?
- Date: Fri, 24 Aug 2007 12:13:42 -0500
- Cc: zsh users <zsh-users@xxxxxxxxxx>
- In-reply-to: <200708241706.l7OH6gXe032329@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <2d460de70708241001t59382ae6j3dc201de7d3ca899@xxxxxxxxxxxxxx> <200708241706.l7OH6gXe032329@xxxxxxxxxxxxxx>
In the last episode (Aug 24), Peter Stephenson said:
> "Richard Hartmann" wrote:
> > I have been unable to make PgUp / PgDown act like Bash's
> > reverse search. I.e., you enter some string and then press
> > PgUp / PgDown to search for commands that start with this
> > string.
>
> bindkey '^[[5~' history-beginning-search-backward
> bindkey '^[[6~' history-beginning-search-forward
>
> Use "read" with no arguments to verify that's what your PageUp and
> PageDown are sending; hit ^C to exit.
I use a helper function in my zshrc to set up all my bindings:
# usage: bindtc <cap> <default> <zsh-command>
bindtc ()
{
setopt localoptions
local keyval=$(echotc "$1" 2>&-)
[[ $keyval == "no" ]] && keyval=""
bindkey "${keyval:-$2}" "$3"
}
# Bindings for PGUP, PGDN, HOME, END
bindtc kP "^[[I" history-beginning-search-backward
bindtc kN "^[[G" history-beginning-search-forward
bindtc kh "^[[H" beginning-of-line
bindtc kH "^[[F" end-of-line
--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author