zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: are there some ways to get things like isearch-{start,end}-position?
Date: Sat, 24 Sep 2011 11:17:52 -0700	[thread overview]
Message-ID: <110924111752.ZM24907@torch.brasslantern.com> (raw)
In-Reply-To: <CACLLAdkRdQ1YFDyqsyLfkFw-irqRyQuQOkJsTEPwueW7qmN0gQ@mail.gmail.com>

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.


  reply	other threads:[~2011-09-24 18:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-24  6:26 md 1983
2011-09-24 18:17 ` Bart Schaefer [this message]
2011-09-25  4:06   ` Madsen Zhang
2012-03-27  6:58     ` Madsen Zhang
2012-03-27 13:59       ` Bart Schaefer
2012-03-29  6:33         ` Madsen Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110924111752.ZM24907@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).