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?
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author