Zsh Mailing List Archive
Messages sorted by:
Re: is there a mix of history-search-backward and history-beginning-search-backward
- X-seq: zsh-users 2584
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Re: is there a mix of history-search-backward and history-beginning-search-backward
- Date: Wed, 8 Sep 1999 15:55:37 +0000
- In-reply-to: <19990908150213.D4878@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <19990903130450.A28691@xxxxxxxxxxxx> <19990908150213.D4878@xxxxxxxxxxxx>
On Sep 8, 3:02pm, Andy Spiegl wrote:
} Subject: Re: is there a mix of history-search-backward and history-beginni
} Hi again!
} A while ago I asked:
} > I want to bind to ^P a widget that acts like
} > history-beginning-search-backward, but always moves the cursor to the end
} > of the line, like history-search-backward does. Or said the other way:
} > I want history-search-backward to look at more than the first word.
} > Do you know a way to get this behavior?
} Does noone have any idea about this?
Everyone is probably waiting for everyone else to answer. Now you'll
probably get this answer several times.
In 3.0.6, there really is no satisfactory way to get this behavior. The
closest you can come is to use this kind of binding:
bindkey '^Xp' history-beginning-search-backward
bindkey -s '^P' '^X^X^Xp^E'
The first binding is just something to hang the real thing you want to
execute on, so that you can refer to it in the second binding. The second
binding maps ctrl-P to the sequence exchange-point-and-mark (^X^X) followed
by history-beginning-search-backward (^Xp) followed by end-of-line (^E).
The problem is that you have to remember to set the mark with ctrl-space
(or whatever you have bound to set-mark-command) before you begin to press
ctrl-P repeatedly, or exchange-point-and-mark will jump to the wrong place:
zsh resets the mark each time a new prompt is displayed.
In 3.1.6, you can create a custom widget as I just saw that PWS has already
explained, so I won't repeat him.
Bart Schaefer Brass Lantern Enterprises
Messages sorted by: