From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21657 invoked by alias); 29 Mar 2012 06:34:03 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16927 Received: (qmail 27936 invoked from network); 29 Mar 2012 06:33:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.43 as permitted sender) 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== MIME-Version: 1.0 In-Reply-To: <120327065911.ZM6744@torch.brasslantern.com> References: <110924111752.ZM24907@torch.brasslantern.com> <120327065911.ZM6744@torch.brasslantern.com> Date: Thu, 29 Mar 2012 14:33:43 +0800 Message-ID: Subject: Re: are there some ways to get things like isearch-{start,end}-position? From: Madsen Zhang To: Bart Schaefer Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=f46d042c5f83cf469e04bc5be7a0 --f46d042c5f83cf469e04bc5be7a0 Content-Type: text/plain; charset=ISO-8859-1 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 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. > --f46d042c5f83cf469e04bc5be7a0--