Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: accept-line-and-down-history and push-input
- X-seq: zsh-users 15491
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: accept-line-and-down-history and push-input
- Date: Tue, 26 Oct 2010 07:55:44 -0700
- In-reply-to: <AANLkTin4qeNKcBt_TDzY2xt-XJ6aHVH257FOa6iriPSm@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <AANLkTin4qeNKcBt_TDzY2xt-XJ6aHVH257FOa6iriPSm@xxxxxxxxxxxxxx>
On Oct 26, 10:06am, Mikael Magnusson wrote:
}
} I sometimes use accept-line-and-down-history to rerun a series of
} commands, but occasionally need to run another command at some point
} in the middle, but when returning from push-input, I'm left at the end
} of history, not where I was. Is there some clever way I can wrap
} push-input, or something, to make this work?
You can read/assign to HISTNO. Something like this:
with-saved-history-position() {
typeset -g RESTORE_HISTNO=$HISTNO
zle .$WIDGET "$@"
}
zle -N push-input with-saved-history-position
zle-line-init() {
[[ -n $RESTORE_HISTNO ]] && {
HISTNO=$RESTORE_HISTNO
typeset -g RESTORE_HISTNO=''
}
}
zle -N zle-line-init
(I'm beginning to think that zle-line-init should be a builtin widget
that calls an array of hook functions, ala precmd.)
--
Messages sorted by:
Reverse Date,
Date,
Thread,
Author