From 23c2dc1f13510a50d77020a9fd0633cc23afeb8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=84=B3ichiel=20=E2=84=9Boos?= Date: Tue, 16 May 2017 21:26:03 +0200 Subject: [PATCH] Revert most changes in fasd and git-submodule-move --- modules/fasd/functions/fasd | 12 ++++++------ modules/fasd/init.zsh | 4 ++-- modules/git/functions/git-submodule-move | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/fasd/functions/fasd b/modules/fasd/functions/fasd index feb26fe..b6b33be 100644 --- a/modules/fasd/functions/fasd +++ b/modules/fasd/functions/fasd @@ -125,7 +125,7 @@ case $1 in # add current pwd if the option is set [ "$_FASD_TRACK_PWD" = "1" -a "$PWD" != "$HOME" ] && paths="$paths|$PWD" - (( ! "${+paths##\|}" )) && return # stop if we have nothing to add + [ -z "${paths##\|}" ] && return # stop if we have nothing to add # maintain the file local tempfile @@ -312,12 +312,12 @@ $(fasd --backend $each)" while [ "$1" ]; do case $1 in --complete) [ "$2" = "--" ] && shift; set -- $2; local lst=1 r=r comp=1;; --query|--add|--delete|-A|-D) fasd "$@"; return $?;; - --version) (( ! "${+comp}" )) && echo "1.0.1" && return;; + --version) [ -z "$comp" ] && echo "1.0.1" && return;; --) while [ "$2" ]; do shift; fnd="$fnd $1"; last="$1"; done;; -*) local o="${1#-}"; while [ "$o" ]; do case $o in s*) local show=1;; l*) local lst=1;; - i*) (( ! "${+comp}" )) && local interactive=1 show=1;; + i*) [ -z "$comp" ] && local interactive=1 show=1;; r*) local mode=rank;; t*) local mode=recent;; e*) o="${o#?}"; if [ "$o" ]; then # there are characters after "-e" @@ -343,7 +343,7 @@ $(fasd --backend $each)" f*) local typ=f;; R*) local r=r;; [0-9]*) local _fasd_i="$o"; break;; - h*) (( ! "${+comp}" )) && echo "fasd [options] [query ...] + h*) [ -z "$comp" ] && echo "fasd [options] [query ...] [f|a|s|d|z] [options] [query ...] options: -s list paths with scores @@ -376,7 +376,7 @@ fasd [-A|-D] [paths ...] fi;; esac - local R; (( ! "${+r}" )) && R=r || R= # let $R be the opposite of $r + local R; [ -z "$r" ] && R=r || R= # let $R be the opposite of $r fnd="${fnd# }" local res @@ -407,7 +407,7 @@ fasd [-A|-D] [paths ...] fi if [ "$res" ]; then fasd --add "$res" - (( ! "${+exec}" )) && exec='printf %s\n' + [ -z "$exec" ] && exec='printf %s\n' $exec "$res" fi ;; diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh index 6c05477..cc05f62 100644 --- a/modules/fasd/init.zsh +++ b/modules/fasd/init.zsh @@ -6,7 +6,7 @@ fasd_cd() { fasd "$@" else local _fasd_ret="$(fasd -e 'printf %s' "$@")" - (( ! "${+_fasd_ret}" )) && return + [ -z "$_fasd_ret" ] && return [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret" fi } @@ -44,7 +44,7 @@ compctl -U -K _fasd_zsh_cmd_complete -V fasd -x 'C[-1,-*e],s[-]n[1,e]' -c - \ # zsh word mode completion _fasd_zsh_word_complete() { [ "$2" ] && local _fasd_cur="$2" - (( ! "${+_fasd_cur}" )) && local _fasd_cur="${words[CURRENT]}" + [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}" local fnd="${_fasd_cur//,/ }" local typ=${1:-e} fasd --query $typ "$fnd" 2>> "/dev/null" | \ diff --git a/modules/git/functions/git-submodule-move b/modules/git/functions/git-submodule-move index 7cf7bd2..0596785 100644 --- a/modules/git/functions/git-submodule-move +++ b/modules/git/functions/git-submodule-move @@ -12,7 +12,7 @@ local url url="$(command git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")" -if (( ! "${+url}" )); then +if [[ -z "${url}" ]]; then print "${0}: submodule not found: ${src}" >&2 return 1 fi