blob: 31a7567db3b792dd1ab4c4023e1c132a369fd44d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
emulate -L zsh
setopt extendedglob
autoload -U read-from-minibuffer replace-string-again
local p1="Replace: " p2=" with: "
# Saving curwidget is necessary to avoid the widget name being overwritten.
local REPLY previous curwidget=$WIDGET
if (( ${+NUMERIC} )); then
(( $NUMERIC > 0 )) && previous=1
else
zstyle -t ":zle:$WIDGET" edit-previous && previous=1
fi
read-from-minibuffer $p1 ${previous:+$_replace_string_src} || return 1
_replace_string_src=$REPLY
read-from-minibuffer "$p1$_replace_string_src$p2" \
${previous:+$_replace_string_rep} || return 1
_replace_string_rep=$REPLY
replace-string-again $curwidget
|