Fallback for compopt in macOS.

This commit is contained in:
Lazarus Lazaridis 2018-03-05 22:09:48 +02:00
parent 55afbbc10e
commit 967cf1852d

View File

@ -207,14 +207,14 @@ function _complete_goto_aliases()
if [ "${#matches[@]}" -eq "1" ]; then
# remove the filenames attribute from the completion method
compopt +o filenames
compopt +o filenames 2>/dev/null
# if you find only one alias don't append the directory
COMPREPLY=$(printf ${matches[0]} | sed 's/[\t ].*//')
else
for i in "${!matches[@]}"; do
# remove the filenames attribute from the completion method
compopt +o filenames
compopt +o filenames 2>/dev/null
matches[$i]="$(echo ${matches[$i]} | sed 's/[\t]/ /g')"
matches[$i]=$(printf '%*s' "-$COLUMNS" "${matches[$i]}")