Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: are there some ways to get things like isearch-{start,end}-position?
- X-seq: zsh-users 16927
- From: Madsen Zhang <md11235@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: are there some ways to get things like isearch-{start,end}-position?
- Date: Thu, 29 Mar 2012 14:33:43 +0800
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=lsEeMI/yX8ancAV41t7oiuMxi1cpvmWNUVIR6tkfSl0=; b=ZVfsQ/6jomYUqhOxqTIV2BeYtg6SCCOewCzCpDyCqLG7FjQn2+DecdyuMP2CDBrPD/ OE/FZ5CbLI/lv+93xIlL5sF17wrJ5tm0+7YiM8q7YA0a5NSuPSNe2a6Mn/OS819a9fR6 8I/O5wepcTvXJt89o4ZhT8h76hbpKgM/h3XJ8JKLliIZ5EIJQm1kCynFkJWF8uM5rECe HhucpLlZyjIDDtct5jpSaAMD4oLqfY3jIkQsno3mLEcWBf3xJvA5Cu3Z4viZgMcs//Ul xXmGrSt+hKuYpj+U2FJP5x3PLeixluce8F2RHA5Z9tvBWYn1isPMATymz7N4QnZ81eC0 +jFg==
- In-reply-to: <120327065911.ZM6744@torch.brasslantern.com>
- 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: <CACLLAdkRdQ1YFDyqsyLfkFw-irqRyQuQOkJsTEPwueW7qmN0gQ@mail.gmail.com> <110924111752.ZM24907@torch.brasslantern.com> <CACLLAdmCsNhRteYOzmX5CT1KckvLFZnT5-cdaVQOjJYUC45Hqw@mail.gmail.com> <CACLLAdmyvsuH5Gcu4WHf2xCGYkoZjsUp8+VjH_K+TjzJKqeMhw@mail.gmail.com> <120327065911.ZM6744@torch.brasslantern.com>
Good, it works gracefully. your definition of ISEARCHDIR is the same with
what I desired.
Bart, thank you very much :)!
On Tue, Mar 27, 2012 at 9:59 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>wrote:
> On Mar 27, 2:58pm, Madsen Zhang wrote:
> >
> > if the last isearch direction is available, the following script, based
> on
> > the one from Bart Schaefer, should work in both forward and backward
> > isearch:
> >
> > zle-isearch-exit() {
> > if [[ $ISEARCHDIR -eq 1 ]]; then
> > local match mbegin mend
> > setopt extendedglob
> > [[ -n $LASTSEARCH ]] || return 0
> > : ${LBUFFER%(#b)(*)$LASTSEARCH}
> > CURSOR=$mend[1]
> > fi
> >
> > return 0
> > }
> > zle -N zle-isearch-exit
>
> You can set ISEARCHDIR for yourself by putting a little wrapper function
> around history-incremental-search-*.
>
> hist-inc-search-save-direction() {
> if [[ $WIDGET = *-forward ]]; then
> typeset -g ISEARCHDIR=1
> zle .history-incremental-search-forward "$@"
> else
> typeset -g ISEARCHDIR=-1
> zle .history-incremental-search-backward "$@"
> fi
> }
> zle -N history-incremental-search-forward hist-inc-search-save-direction
> zle -N history-incremental-search-backward hist-inc-search-save-direction
>
> I'm not sure I got the semantics of ISEARCHDIR the way you wanted them,
> but you get the idea.
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author