From d1e7c194e9eddb5d8b803e775b5e7320f2baf7c8 Mon Sep 17 00:00:00 2001 From: Lazarus Lazaridis Date: Mon, 5 Mar 2018 22:43:43 +0200 Subject: [PATCH] Differentiate alias completion for Darwin. Refs #1. --- goto.bash | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/goto.bash b/goto.bash index f2be673..1f7b6f2 100644 --- a/goto.bash +++ b/goto.bash @@ -216,10 +216,16 @@ function _complete_goto_aliases() # remove the filenames attribute from the completion method compopt +o filenames 2>/dev/null - matches[$i]="$(echo ${matches[$i]} | sed 's/[\t]/ /g')" - matches[$i]=$(printf '%*s' "-$COLUMNS" "${matches[$i]}") + if ! [[ $(uname -s) =~ Darwin* ]]; then + matches[$i]="$(echo ${matches[$i]} | sed 's/[\t]/ /g')" + matches[$i]=$(printf '%*s' "-$COLUMNS" "${matches[$i]}") - COMPREPLY+=($(compgen -W "${matches[$i]}")) + COMPREPLY+=($(compgen -W "${matches[$i]}")) + else + al=$(echo ${matches[$i]} | sed 's/[\t ].*//') + + COMPREPLY+=($(compgen -W "$al")) + fi done fi }