diff options
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Chpwd/zsh_directory_name_cdr | 2 | ||||
-rw-r--r-- | Functions/MIME/.distfiles | 5 | ||||
-rw-r--r-- | Functions/MIME/zsh-mime-contexts | 24 | ||||
-rw-r--r-- | Functions/MIME/zsh-mime-handler | 70 | ||||
-rw-r--r-- | Functions/Misc/zargs | 4 | ||||
-rw-r--r-- | Functions/Prompts/prompt_bart_setup | 30 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_detect_svn | 4 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr | 89 | ||||
-rw-r--r-- | Functions/VCS_Info/vcs_info | 3 | ||||
-rw-r--r-- | Functions/Zle/.distfiles | 1 | ||||
-rw-r--r-- | Functions/Zle/define-composed-chars | 58 | ||||
-rw-r--r-- | Functions/Zle/match-words-by-style | 3 | ||||
-rw-r--r-- | Functions/Zle/move-line-in-buffer | 16 | ||||
-rw-r--r-- | Functions/Zle/read-from-minibuffer | 35 | ||||
-rw-r--r-- | Functions/Zle/replace-string | 20 | ||||
-rw-r--r-- | Functions/Zle/replace-string-again | 6 |
16 files changed, 304 insertions, 66 deletions
diff --git a/Functions/Chpwd/zsh_directory_name_cdr b/Functions/Chpwd/zsh_directory_name_cdr index 09aa35a93..c9be7db0c 100644 --- a/Functions/Chpwd/zsh_directory_name_cdr +++ b/Functions/Chpwd/zsh_directory_name_cdr @@ -18,7 +18,7 @@ elif [[ $1 = c ]]; then values=(${${(f)"$(cdr -l)"}/ ##/:}) keys=(${values%%:*}) _describe -t dir-index 'recent directory index' \ - values keys -V unsorted -S']' + values -V unsorted -S']' return fi fi diff --git a/Functions/MIME/.distfiles b/Functions/MIME/.distfiles index 01ac0d7ef..93c13f7da 100644 --- a/Functions/MIME/.distfiles +++ b/Functions/MIME/.distfiles @@ -1,4 +1,7 @@ DISTFILES_SRC=' .distfiles -zsh-mime-setup zsh-mime-handler pick-web-browser +pick-web-browser +zsh-mime-contexts +zsh-mime-handler +zsh-mime-setup ' diff --git a/Functions/MIME/zsh-mime-contexts b/Functions/MIME/zsh-mime-contexts new file mode 100644 index 000000000..08f125158 --- /dev/null +++ b/Functions/MIME/zsh-mime-contexts @@ -0,0 +1,24 @@ +# Helper for zsh-mime-handler. +# +# Pass in a zstyle option, a suffix, which might include multiple parts +# (e.g. pdf.gz), plus remaining zstyle arguments plus arguments to zstyle. +# Try to match the style starting with the longest possible suffix. + +local context suffix option + +option=$1 +shift +suffix=$1 +shift + +while true; do + context=":mime:.${suffix}:" + zstyle $option $context "$@" && return 0 + if [[ $suffix = *.* ]]; then + suffix=${suffix#*.} + else + break + fi +done + +return 1 diff --git a/Functions/MIME/zsh-mime-handler b/Functions/MIME/zsh-mime-handler index 9a40e67bb..abaf0b6e3 100644 --- a/Functions/MIME/zsh-mime-handler +++ b/Functions/MIME/zsh-mime-handler @@ -34,6 +34,8 @@ setopt extendedglob cbases nullglob $autocd # We need zformat from zsh/zutil for %s replacement. zmodload -i zsh/zutil +autoload -Uz zsh-mime-contexts + # Look for options. Because of the way this is usually invoked, # (there is always a command to be handled), only handle options # up to second last argument. @@ -62,12 +64,15 @@ shift $(( OPTIND - 1 )) # just as well pass them all down. However, we just take the # suffix from the first since that's what invoked us via suffix -s. -local suffix context +local suffix s local -a match mbegin mend -[[ $1 = (#b)*.([^.]##) ]] || return 1 -suffix=${(L)match[1]} -context=":mime:.${suffix}:" +suffix=${1:t} +if [[ $suffix != *.* ]]; then + "No suffix in command: $1" >&2 + return 1 +fi +suffix=${suffix#*.} local handler flags no_sh no_bg arg integer i @@ -77,11 +82,11 @@ local -a exec_asis hand_nonex # despite being called for interpretation by the mime handler. # Defaults to executable files, which ensures that they are executed as # they are, even if they have a suffix. -zstyle -a $context execute-as-is exec_asis || exec_asis=('*(*)' '*(/)') +zsh-mime-contexts -a $suffix execute-as-is exec_asis || exec_asis=('*(*)' '*(/)') # Set to a list of patterns for which the handler will be used even # if the file doesn't exist on the disk. -zstyle -a $context handle-nonexistent hand_nonex || +zsh-mime-contexts -a $suffix handle-nonexistent hand_nonex || hand_nonex=('[[:alpha:]]#:/*') local pattern @@ -92,9 +97,9 @@ local -a files # actual file or its directory. local dir local -a filepath -if zstyle -t $context find-file-in-path && [[ $1 != /* ]] && +if zsh-mime-contexts -t $suffix find-file-in-path && [[ $1 != /* ]] && [[ $1 != */* || -o pathdirs ]]; then - zstyle -a $context file-path filepath || filepath=($path) + zsh-mime-contexts -a $suffix file-path filepath || filepath=($path) for dir in $filepath; do if [[ -e $dir/$1 ]]; then 1=$dir/$1 @@ -153,19 +158,54 @@ if [[ ! -e $1 ]]; then fi fi -zstyle -s $context handler handler || - handler="${zsh_mime_handlers[$suffix]}" -zstyle -s $context flags flags || - flags="${zsh_mime_flags[$suffix]}" +if ! zsh-mime-contexts -s $suffix handler handler; then + # Look for handler starting with longest suffix match. + # Typically we'd only get a match for the shortest, but don't assume so. + s=$suffix + while true; do + handler="${zsh_mime_handlers[$s]}" + if [[ -n $handler ]]; then + break + fi + if [[ $s = *.* ]]; then + s=${s#*.} + else + break + fi + done + if [[ -z $handler ]]; then + if [[ $suffix = *.* ]]; then + print "No handler specified for suffix .$suffix or any final part" >&2 + else + print "No handler specified for suffix .$suffix" >&2 + fi + return 1 + fi +fi +if ! zsh-mime-contexts -s $suffix flags flags; then + # Same again for flags. + s=$suffix + while true; do + flags="${zsh_mime_flags[$suffix]}" + if [[ -n $flags ]]; then + break + fi + if [[ $s = *.* ]]; then + s=${s#*.} + else + break + fi + done +fi # Set to yes if we use eval instead of sh -c for complicated mailcap lines # Can possibly break some mailcap entries which expect sh compatibility, # but is faster, as a new process is not spawned. -zstyle -t $context current-shell && no_sh=yes +zsh-mime-contexts -t $suffix current-shell && no_sh=yes # Set to yes if the process shouldn't be backgrounded even if it doesn't need a # terminal and display is set. -zstyle -t $context never-background && no_bg=yes +zsh-mime-contexts -t $suffix never-background && no_bg=yes local hasmeta stdin @@ -241,7 +281,7 @@ if [[ $flags = *copiousoutput* ]]; then # We need to page the output. # Careful in case PAGER is a set of commands and arguments. local -a pager - zstyle -a $context pager pager || pager=(${=PAGER:-more}) + zsh-mime-contexts -a $suffix pager pager || pager=(${=PAGER:-more}) if [[ -n $stdin ]]; then cat $argv | $execargs | $pager else diff --git a/Functions/Misc/zargs b/Functions/Misc/zargs index 58d84617e..8350b1aba 100644 --- a/Functions/Misc/zargs +++ b/Functions/Misc/zargs @@ -207,7 +207,7 @@ then else call=($command) # Use "repeat" here so "continue" won't complain. - repeat 1 eval "$execute ; $analyze" + repeat 1; do eval "$execute ; $analyze"; done return $ret fi fi @@ -273,7 +273,7 @@ do repeat $P do ((ARGC)) || break - for (( end=l; end && ${(c)#argv[1,end]} > s; end/=2 )) : + for (( end=l; end && ${(c)#argv[1,end]} > s; end/=2 )) { } (( end > n && ( end = n ) )) args=( $argv[1,end] ) shift $((end > ARGC ? ARGC : end)) diff --git a/Functions/Prompts/prompt_bart_setup b/Functions/Prompts/prompt_bart_setup index 1cc7b6f08..6cbbb71c7 100644 --- a/Functions/Prompts/prompt_bart_setup +++ b/Functions/Prompts/prompt_bart_setup @@ -67,15 +67,39 @@ prompt_bart_help () { } integer PSCOL=1 +typeset PSCMD= + +prompt_bart_preexec () { + setopt localoptions noxtrace noshwordsplit noksharrays unset + local -a cmd; cmd=( ${(z)3} ) + if [[ $cmd[1] = fg ]] + then + shift cmd + cmd[1]=${cmd[1]:-%+} + fi + if [[ $#cmd -eq 1 && $cmd[1] = %* ]] + then + PSCMD=$jobtexts[$cmd[1]] + elif [[ -o autoresume && -n $jobtexts[%?$2] ]] + then + PSCMD=$jobtexts[%?$2] + else + # Use history text to avoid alias expansion + PSCMD=$history[$HISTCMD] + fi + return 0 +} prompt_bart_precmd () { setopt localoptions noxtrace noksharrays unset local zero='%([BSUbfksu]|[FB]{*})' escape colno lineno + : "${PSCMD:=$history[$[HISTCMD-1]]}" # Default to history text + # Using psvar here protects against unwanted promptsubst expansions. - psvar[7]="$history[$[HISTCMD-1]]" # Use history text, not just number - psvar[8]='' # No padding until we compute it + psvar[7]="$PSCMD" + psvar[8]='' # No padding until we compute it psvar[9]=() typeset -g PSCOL @@ -153,6 +177,7 @@ prompt_bart_setup () { repeat 1 case "$1:l" in (off|disable) add-zsh-hook -D precmd "prompt_*_precmd" + add-zsh-hook -D preexec "prompt_*_preexec" functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch}" [[ $prompt_theme[1] = bart ]] && PS1=${${(f)PS1}[-1]} return 1 @@ -182,6 +207,7 @@ prompt_bart_setup () { # Paste our special commands into precmd and TRAPWINCH add-zsh-hook precmd prompt_bart_precmd + add-zsh-hook preexec prompt_bart_preexec functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch} prompt_bart_winch" diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_svn b/Functions/VCS_Info/Backends/VCS_INFO_detect_svn index a777ecc43..43dedcde9 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_detect_svn +++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_svn @@ -7,5 +7,5 @@ setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && return 1 VCS_INFO_check_com ${vcs_comm[cmd]} || return 1 -{ [[ -f ".svn/entries" ]] || [[ -f ".svn/format" ]] } && return 0 -return 1 +vcs_comm[detect_need_file]="entries format" +VCS_INFO_bydir_detect '.svn' || return 1 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr index 5d4deaac9..cae1a3b08 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr @@ -1,13 +1,52 @@ -## vim:ft=zsh +## vim:ft=zsh et ## bazaar support by: Frank Terbeck <ft@bewatermyfriend.org> +## mostly rewritten by: Jan Pobrislo <ccx@webprojekty.cz> ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions noksharrays extendedglob NO_shwordsplit -local bzrbase bzrbr +local bzrbase bzrbr bzr_changes bzr_type local -a bzrinfo -local -xA hook_com +local -xA hook_com bzr_info + +VCS_INFO_bzr_get_info() { + bzrinfo=( ${(s.:.)$( ${vcs_comm[cmd]} version-info --custom \ + --template="{revno}:{branch_nick}:{clean}")} ) + if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" + then + VCS_INFO_bzr_get_changes + elif [[ ${bzrinfo[2]} == 1 ]] + then + bzr_changes = '1' + fi +} + +VCS_INFO_bzr_get_info_restricted() { + # we are forbidden from fetching info on bound branch from remote repository + bzrinfo=( $(${vcs_comm[cmd]} revno) ${bzrbase:t} ) + if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" && \ + [[ ! $bzr_type == lightweigth ]] + then + VCS_INFO_bzr_get_changes + fi +} + +VCS_INFO_bzr_get_changes() { + local -A counts + local line flag + bzr_changes=$( + ${vcs_comm[cmd]} stat -SV | while read flag line + do + counts[${flag}]=$(( ${counts[${flag}]:-0} + 1 )) + done + for flag in ${(k)counts} + do + printf "%s:%d " $flag ${counts[${flag}]} + done + ) +} if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "use-simple" ; then + # simple parsing will fail to fetch information from lightweigth checkouts bzrbase=${vcs_comm[basedir]} bzrinfo[2]=${bzrbase:t} if [[ -f ${bzrbase}/.bzr/branch/last-revision ]] ; then @@ -15,9 +54,46 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "use-simple" ; then bzrinfo[1]=${${bzrinfo[1]}%% *} fi else - bzrbase=${${(M)${(f)"$( ${vcs_comm[cmd]} info )"}:# ##branch\ root:*}/*: ##/} - bzrinfo=( ${${${(M)${(f)"$( ${vcs_comm[cmd]} version-info )"}:#(#s)(revno|branch-nick)*}/*: /}/*\//} ) + # Parse the output of 'bzr info' into associative array bzr_info + ${vcs_comm[cmd]} info | { + local line key value dirtype + read dirtype + grep '^[ a-zA-Z0-9]\+: ' | while read line + do + value=${line#*': '} + key=${${line%%: *}// /_} + bzr_info[$key]=$value + done + } + + case "$dirtype" in + ('Checkout'*) + bzr_type=checkout + bzrbase=${bzr_info[checkout_root]} ;; + ('Repository checkout'*) + bzr_type=checkout + bzrbase=${bzr_info[repository_checkout_root]} ;; + ('Lightweight checkout'*) + bzr_type=lightweigth + bzrbase=${bzr_info[light_checkout_root]} ;; + (*) + bzr_type=standalone + bzrbase=${bzr_info[branch_root]} ;; + esac + bzrbase="$(VCS_INFO_realpath ${bzrbase})" + + if [ -n "${bzr_info[checkout_of_branch]}" ] && \ + zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "use-server" + then + VCS_INFO_bzr_get_info + else + case ${bzr_info[checkout_of_branch]} in + (file://*) VCS_INFO_bzr_get_info ;; + (*://*) VCS_INFO_bzr_get_info_restricted ;; + (*) VCS_INFO_bzr_get_info ;; + esac + fi fi rrn=${bzrbase:t} @@ -29,5 +105,6 @@ else bzrbr=${hook_com[branch-replace]} fi hook_com=() -VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" '' '' "${bzrinfo[1]}" '' + +VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" '' "${bzr_changes}" "${bzrinfo[1]}" "${bzr_changes}" return 0 diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info index 513489b70..5a421dfed 100644 --- a/Functions/VCS_Info/vcs_info +++ b/Functions/VCS_Info/vcs_info @@ -70,6 +70,9 @@ vcs_info () { if (( retval == 1 )); then return 0 elif (( retval == 2 )); then + # This needs `max-exports' set. We're still setting it again later + # for more specific contexts. + VCS_INFO_maxexports VCS_INFO_set --nvcs return 0 fi diff --git a/Functions/Zle/.distfiles b/Functions/Zle/.distfiles index 22eef1e6e..256044fa5 100644 --- a/Functions/Zle/.distfiles +++ b/Functions/Zle/.distfiles @@ -25,6 +25,7 @@ kill-word-match match-word-context match-words-by-style modify-current-argument +move-line-in-buffer narrow-to-region narrow-to-region-invisible predict-on diff --git a/Functions/Zle/define-composed-chars b/Functions/Zle/define-composed-chars index 12a357fc1..15d693a3f 100644 --- a/Functions/Zle/define-composed-chars +++ b/Functions/Zle/define-composed-chars @@ -135,6 +135,26 @@ a=j z[$a]="\ i 133 \ " +# ligature with f +a=f +z[$a]="\ +f FB00 \ +" +# ligature with i +a=i +z[$a]="\ +f FB01 \ +" +# ligature with l +a=l +z[$a]="\ +f FB02 \ +" +# ligature with t +a=t +z[$a]="\ +f FB05 s FB06 \ +" # eszett a=s z[$a]="\ @@ -252,6 +272,19 @@ z[$a]+=" Z 5e6" a=h z[$a]+=" S 5e9" +# Superscripts +a=S +z[$a]+=" \ +0 2070 1 B9 2 B2 3 B3 4 2074 5 2075 6 2076 7 2077 8 2078 9 2079 \ ++ 207a - 207b = 207C ( 207D ) 207E n 207f \ +" +# Subscripts +a=s +z[$a]+=" \ +0 2080 1 2081 2 2082 3 2083 4 2084 5 2085 6 2086 7 2087 8 2088 9 2089 \ ++ 208a - 208b = 208C ( 208D ) 208E \ +" + typeset -i 16 -Z 4 ia typeset -i 16 -Z 6 iuni # Extended width characters ^A, ^B, ... (not RFC1345) @@ -327,10 +360,14 @@ z[g]+=" R AE" z[m]+=" ' AF" # degree z[G]+=" D B0" +# degree centigrade +z[C]+=" o 2103" +# degree fahrenheit +z[F]+=" o 2109" +# numero +z[0]+=" N 2116" # +/- z[-]+=" + B1" -# superscripts -z[S]+=" 2 B2 3 B3" # lonely acute a=\' z[$a]+=" ' B4" @@ -342,8 +379,6 @@ z[I]+=" P B6" z[M]+=" . B7" # Lonely cedilla z[,]+=" ' B8" -# Superscript one -z[S]+=" 1 B9" # spanish masculine ordinal z[o]+=" - BA" # right guillemet @@ -415,5 +450,20 @@ z[0]+=" 0 221E" # Female and male z[m]+=" F 2640" z[l]+=" M 2642" +# Commercial AT +z[t]+=" A 40" +# Prime, double prime, triple prime +a=\' +z[$a]+=" 1 2032 2 2033 3 2034" +# Arrows +z[-]+=" < 2190" +a=\! +z[$a]+=" - 2191" +a=\> +z[$a]+=" - 2192 < 2194 = 21D2" +z[v]+=" - 2193" +z[D]+=" U 2195" +a=\= +z[$a]+=" < 21D0 = 21D4" zsh_accented_chars=("${(kv)z[@]}") diff --git a/Functions/Zle/match-words-by-style b/Functions/Zle/match-words-by-style index 69ceba76a..b387828f3 100644 --- a/Functions/Zle/match-words-by-style +++ b/Functions/Zle/match-words-by-style @@ -220,8 +220,7 @@ if [[ $wordstyle = *subword* ]]; then fi match=() -charskip= -repeat $skip charskip+=\? +charskip=${(l:skip::?:)} eval pat2='${RBUFFER##(#b)('${charskip}${spacepat}')('\ ${wordpat2}')('${spacepat}')}' diff --git a/Functions/Zle/move-line-in-buffer b/Functions/Zle/move-line-in-buffer new file mode 100644 index 000000000..5f37a9d71 --- /dev/null +++ b/Functions/Zle/move-line-in-buffer @@ -0,0 +1,16 @@ +#autoload + +# Line motions that do not leave the current history entry, +# for editing in multi-line buffers. + +# To use: +# autoload -Uz move-line-in-buffer +# zle -N up-line-in-buffer move-line-in-buffer +# zle -N down-line-in-buffer move-line-in-buffer +# +# then bindkey as you prefer + +local hno=$HISTNO curs=$CURSOR +zle .${WIDGET:s/in-buffer/or-history} "$@" && + (( HISTNO != hno && (HISTNO=hno, CURSOR=curs) )) +return 0 diff --git a/Functions/Zle/read-from-minibuffer b/Functions/Zle/read-from-minibuffer index fce6b5319..57e926884 100644 --- a/Functions/Zle/read-from-minibuffer +++ b/Functions/Zle/read-from-minibuffer @@ -19,26 +19,19 @@ while getopts "k:" opt; do done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) +local readprompt="$1" lbuf_init="$2" rbuf_init="$3" + +# Use anonymous function to make sure special values get restored, +# even if this function is called as a widget. +# local +h ensures special parameters stay special. +() { local pretext="$PREDISPLAY$LBUFFER$RBUFFER$POSTDISPLAY " -# We could use the local variables mechanism to save these -# values, but if read-from-minibuffer is called as a widget -# (which isn't actually all that useful) the values won't be -# restored because the variables are already local at the current -# level and don't get restored when they go out of scope. -# We could do it with an additional function level. - local save_lbuffer=$LBUFFER - local save_rbuffer=$RBUFFER - local save_predisplay=$PREDISPLAY - local save_postdisplay=$POSTDISPLAY - local -a save_region_highlight - save_region_highlight=("${region_highlight[@]}") - -{ - LBUFFER="$2" - RBUFFER="$3" - PREDISPLAY="$pretext${1:-? }" - POSTDISPLAY= + local +h LBUFFER="$lbuf_init" + local +h RBUFFER="$rbuf_init" + local +h PREDISPLAY="$pretext${readprompt:-? }" + local +h POSTDISPLAY= + local +h -a region_highlight region_highlight=("P${#pretext} ${#PREDISPLAY} bold") if [[ -n $keys ]]; then @@ -50,12 +43,6 @@ done stat=$? (( stat )) || REPLY=$BUFFER fi -} always { - LBUFFER=$save_lbuffer - RBUFFER=$save_rbuffer - PREDISPLAY=$save_predisplay - POSTDISPLAY=$save_postdisplay - region_highlight=("${save_region_highlight[@]}") } return $stat diff --git a/Functions/Zle/replace-string b/Functions/Zle/replace-string index bc608e577..a3416a403 100644 --- a/Functions/Zle/replace-string +++ b/Functions/Zle/replace-string @@ -3,7 +3,15 @@ setopt extendedglob autoload -Uz read-from-minibuffer replace-string-again -local p1="Replace: " p2=" with: " +local p1 p2 + +if [[ -n $_replace_string_src ]]; then + p1="[$_replace_string_src -> $_replace_string_rep]"$'\n' +fi + +p1+="Replace: " +p2=" with: " + # Saving curwidget is necessary to avoid the widget name being overwritten. local REPLY previous curwidget=$WIDGET @@ -14,10 +22,12 @@ else fi read-from-minibuffer $p1 ${previous:+$_replace_string_src} || return 1 -typeset -g _replace_string_src=$REPLY +if [[ -n $REPLY ]]; then + typeset -g _replace_string_src=$REPLY -read-from-minibuffer "$p1$_replace_string_src$p2" \ - ${previous:+$_replace_string_rep} || return 1 -typeset -g _replace_string_rep=$REPLY + read-from-minibuffer "$p1$_replace_string_src$p2" \ + ${previous:+$_replace_string_rep} || return 1 + typeset -g _replace_string_rep=$REPLY +fi replace-string-again $curwidget diff --git a/Functions/Zle/replace-string-again b/Functions/Zle/replace-string-again index f24c14f88..dac3db755 100644 --- a/Functions/Zle/replace-string-again +++ b/Functions/Zle/replace-string-again @@ -40,8 +40,10 @@ if [[ $curwidget = *(pattern|regex)* ]]; then rep2+=$rep if [[ $curwidget = *regex* ]]; then autoload -Uz regexp-replace - regexp-replace LBUFFER $_replace_string_src $rep2 || return 1 - regexp-replace RBUFFER $_replace_string_src $rep2 || return 1 + integer ret=1 + regexp-replace LBUFFER $_replace_string_src $rep2 && ret=0 + regexp-replace RBUFFER $_replace_string_src $rep2 && ret=0 + return ret else LBUFFER=${LBUFFER//(#bm)$~_replace_string_src/${(e)rep2}} RBUFFER=${RBUFFER//(#bm)$~_replace_string_src/${(e)rep2}} |