From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27852 invoked by alias); 24 Sep 2011 18:18:12 -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: 16417 Received: (qmail 26230 invoked from network); 24 Sep 2011 18:18:10 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110924111752.ZM24907@torch.brasslantern.com> Date: Sat, 24 Sep 2011 11:17:52 -0700 In-reply-to: Comments: In reply to md 1983 "are there some ways to get things like isearch-{start,end}-position?" (Sep 24, 2:26pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: are there some ways to get things like isearch-{start,end}-position? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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.