Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Add a hook on isearch
- X-seq: zsh-workers 28272
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Add a hook on isearch
- Date: Sat, 18 Sep 2010 18:50:42 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=UnRxw3EkEpCFt4KmCLCXHrk6yRL+rmCasaFUXHv+y6s=; b=j7w6p+4y/izL6YTWNK30QjvJQ0eTfA+nKENpTbUr5VIg7pf2F2wRws7WdyJMvclNJs Ix0MuKbia7McVQ7iKxfRZCgp1jKGsNQ4CkbUZWOPS5tyiloMAHFSCeKtmyw6exnqsjX9 msF8U3rhFuSEPIY0PoOzwXHKHgDqBEMT2BZjA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=QjjLXYS4ErNvrK3neKadeuN7WwMH+4ti3/mVkvTZuPmMmoxNrKfve9sxgcUMEeyIyC AdBEyN5Z5LmE9TKpxbSR/0VzExgUavGn02gLBWwLceZaOiroGLei/O0m9tbrxWzklE/V +5ZsyoVG1KEftolN50WZwQtVLCe6avK3qts0o=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This might make something explode, but it's probably pretty useful.
function _show_surroundings() {
typeset -a output
typeset -A star
star[$HISTNO]="*"
for ((i = HISTNO - ${NUMERIC:-5}; i < HISTNO + ${NUMERIC:-5} && i <
HISTCMD; i++)); do
output=( "$star[$i]$i: $history[$i]" $output )
done
zle -M ${(pj:\n:)output}
}
zle -N zle-isearch-update _show_surroundings
% edit .zshrc
bck-i-search: edit .zshrc_
2293: src
*2292: edit .zshrc
2291: zle-isearch-update() { zle _show_surroundings }
2290: zle-isearch-update() { zle -M $HISTNO }
2289: zle-isearch-update() { zle -M lol }
2288: zle -N zle-isearch-update
2287: echo $history[HISTCMD]
commit 8ab10e2394da712db896662316fb4df304c212ef
Author: Mikael Magnusson <mikachu@xxxxxxxxx>
Date: Sat Sep 18 18:46:38 2010 +0200
Add zle-isearch-update
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index d9586b8..1daf8e1 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1472,7 +1472,16 @@ doisearch(char **args, int dir, int pattern)
} else
isearch_active = 0;
ref:
+ if ((cmd = rthingy_nocreate("zle-isearch-update"))) {
+ char *args[2];
+ args[0] = cmd->nam;
+ args[1] = NULL;
+ execzlefunc(cmd, args, 1);
+ unrefthingy(cmd);
+ }
+
zrefresh();
+
if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak)) {
int i;
aborted = 1;
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author