From a8092bffd9cb45c5845c3e43b62b3b333b01d69f Mon Sep 17 00:00:00 2001 From: "Tom \"Ravi\" Hale" Date: Sat, 1 Sep 2018 13:27:53 +0700 Subject: [PATCH] Clean up ls_with_file_shortcuts() shwordsplit tests --- lib/git/shell_shortcuts.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/git/shell_shortcuts.sh b/lib/git/shell_shortcuts.sh index d7fb8c4..1cf72f7 100644 --- a/lib/git/shell_shortcuts.sh +++ b/lib/git/shell_shortcuts.sh @@ -120,7 +120,7 @@ if [ "$shell_ls_aliases_enabled" = "true" ] && which ruby > /dev/null 2>&1; then if [[ $shell == "zsh" ]]; then # Ensure sh_word_split is on - if setopt | grep -q shwordsplit; then SHWORDSPLIT_ON=true; fi + [[ -o shwordsplit ]] && SHWORDSPLIT_ON=true setopt shwordsplit fi @@ -144,6 +144,7 @@ if [ "$shell_ls_aliases_enabled" = "true" ] && which ruby > /dev/null 2>&1; then ll_output=$(echo "$ll_output" | \sed -$SED_REGEX_ARG "s/ $USER/ $(/bin/cat "$HOME/.user_sym")/g" | rejustify_ls_columns) fi + # Bail if there are two many lines to process if [ "$(echo "$ll_output" | wc -l)" -gt "50" ]; then echo -e "\033[33mToo many files to create shortcuts. Running plain ll command...\033[0m" echo "$ll_output" @@ -183,7 +184,7 @@ EOF done # Turn off shwordsplit unless it was on previously - if [[ $shell == "zsh" ]] && [ -z "$SHWORDSPLIT_ON" ]; then unsetopt shwordsplit; fi + if [[ $shell == "zsh" && -z $SHWORDSPLIT_ON ]]; then unsetopt shwordsplit; fi } # Setup aliases