diff --git a/activator.plugin.zsh b/activator.plugin.zsh index e83af4c..dd61702 100644 --- a/activator.plugin.zsh +++ b/activator.plugin.zsh @@ -107,12 +107,12 @@ _CA__ERROR_CLEANUP() { [[ $CODE_ACTIVATOR__DISABLE_SHORTCUT -eq 0 ]] && { _CA__ZSH_SHORTCUT_PLUGIN() { - local OPTIONS=$(_CA__GET_COMMANDS_AND_PROJECTS | sed 's/\s\+/\n/g') + local OPTIONS=$(_CA__GET_COMMANDS_AND_PROJECTS | _CA__SED_MULTILINE) [ ! $__CUSTOM_ENV_ACTIVE ] && OPTIONS=$(echo $OPTIONS | grep -v 'deactivate') local ARGUMENT=$(\ echo $OPTIONS \ - | sed 's/\s\+/\n/g' \ + | _CA__SED_MULTILINE \ | $_CA__FZF --prompt 'select a project: ' \ ) diff --git a/zsh/helpers.zsh b/zsh/helpers.zsh index d2e6520..1af6073 100644 --- a/zsh/helpers.zsh +++ b/zsh/helpers.zsh @@ -22,7 +22,7 @@ _CA__GET_FULL_PATH() { local FULL_BASE_DIR=$(\ echo $CODE_ACTIVATOR__DIRS \ - | sed 's/\s\+/\n/g' \ + | _CA__SED_MULTILINE \ | grep "^.*/$PROJECT_ROOT_SHORT$" \ ) @@ -44,17 +44,17 @@ _CA__SELECT_BASE_DIR() { BASE_NAMES=($BASE_NAMES $(basename $dir)) done - echo $CODE_ACTIVATOR__DIRS | sed 's/\s\+/\n/g' \ + echo $CODE_ACTIVATOR__DIRS | _CA__SED_MULTILINE \ | grep $(\ echo $BASE_NAMES \ - | sed 's/\s\+/\n/g' \ + | _CA__SED_MULTILINE \ | $_CA__FZF --prompt 'select base directory : ') } _CA__GET_REMOTE_TARGET() { local REMOTE_TARGET=$(\ echo $CODE_ACTIVATOR__KNOWN_TARGETS \ - | sed 's/\s\+/\n/g' \ + | _CA__SED_MULTILINE \ | $_CA__FZF --print-query --prompt 'set a remote target : ' \ | tail -1 \ ) @@ -107,7 +107,7 @@ _CA__SELECT_VIRTUAL_ENV() { VERSION=$(\ nodeenv --list 2>&1 \ - | sed 's/\s\+/\n/g' \ + | _CA__SED_MULTILINE \ | $_CA__FZF --prompt 'select a node version : '\ ) @@ -159,6 +159,8 @@ _CA__INIT_CUSTOM_ENV() { cp $CUSTOM_ENV_TEMPLATE $CUSTOM_ENV } +_CA__SED_MULTILINE() { sed 's/\s\+/\n/g'; } + ##################################################################### export _CA__HELPERS_LOADED=1