From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29438 invoked by alias); 25 Sep 2011 04:06:51 -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: 16427 Received: (qmail 29093 invoked from network); 25 Sep 2011 04:06:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=rYEJXdQIZVcgPc/GR0eG+F2eRSbGVEjBlc569xgb0PY=; b=t3aW+iqQTb9odX6frAy46xgqhsyjLoqs81L+npoevRJGAPdm9ZdKLWXMGy9TQi6+9x pAmYppfoCgOmShLySiPR+kHhU/4JssZxGcf/MTSz6OUTCVjC6H8jtFNlQz7S4HZvKM4Y MCOaF0uFJgeOFDs+eJRjXmUqpgKPcOZj42SBA= MIME-Version: 1.0 In-Reply-To: <110924111752.ZM24907@torch.brasslantern.com> References: <110924111752.ZM24907@torch.brasslantern.com> Date: Sun, 25 Sep 2011 12:06:41 +0800 Message-ID: Subject: Re: are there some ways to get things like isearch-{start,end}-position? From: Madsen Zhang To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=0015174c371877d6f704adbc2bb8 --0015174c371877d6f704adbc2bb8 Content-Type: text/plain; charset=ISO-8859-1 Fantastic solution:). Bart, thank you very much!! On Sun, Sep 25, 2011 at 2:17 AM, Bart Schaefer wrote: > On Sep 24, 2:26pm, md 1983 wrote: > } > } I want to upon exiting isearch mode always place the cursor in ZLE at > } the position as specified by the variable "isearch_start" in zsh's > } source code, no matter it's a forward or backward search. > > You should be able to use the special zle-isearch-exit widget and the > $LASTSEARCH variable to find the point in the buffer that was matched > by the search. Here's a crude effort: > > zle-isearch-exit() { > local match mbegin mend > setopt extendedglob > [[ -n $LASTSEARCH ]] || return 0 > : ${BUFFER#(#b)(*)$LASTSEARCH} > CURSOR=$mend[1] > return 0 > } > zle -N zle-isearch-exit > > I agree that it would be nice to pass the search region at least to > zle-isearch-exit and zle-isearch-update if not to make them generally > available. > --0015174c371877d6f704adbc2bb8--