diff --git a/bash_completion b/bash_completion index e707ff5f..d43075e8 100644 --- a/bash_completion +++ b/bash_completion @@ -1960,13 +1960,15 @@ complete -F _minimal '' _completion_loader() { # $1=_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier - local cmd="${1:-_EmptycmD_}" compdir=./completions compfile + local cmd="${1:-_EmptycmD_}" compdir=./completions compfile dir [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions" - for compfile in "${cmd##*/}" "${cmd##*/}".bash _"${cmd##*/}"; do - compfile="$compdir/$compfile" - # Avoid trying to source dirs; https://bugzilla.redhat.com/903540 - [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124 + for dir in ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions $compdir; do + for compfile in "${cmd##*/}" "${cmd##*/}".bash _"${cmd##*/}"; do + compfile="$dir/$compfile" + # Avoid trying to source dirs; https://bugzilla.redhat.com/903540 + [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124 + done done # Need to define *something*, otherwise there will be no completion at all.