Index: clang/utils/bash-autocomplete.sh =================================================================== --- clang/utils/bash-autocomplete.sh +++ clang/utils/bash-autocomplete.sh @@ -1,7 +1,7 @@ # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this. _clang() { - local cur prev words cword arg + local cur prev words cword arg="" _init_completion -n : || return # bash always separates '=' as a token even if there's no space before/after '='. @@ -22,16 +22,17 @@ elif [[ "$w2" == -* && "$w1" == '=' ]]; then # -foo=bar arg="$w2=,$cur" - else - _filedir fi local flags=$( clang --autocomplete="$arg" ) - if [[ "$cur" == "=" ]]; then + if [[ "$cur" == '=' ]]; then COMPREPLY=( $( compgen -W "$flags" -- "") ) - elif [[ "$flags" == "" ]]; then + elif [[ "$flags" == "" || "$arg" == "" ]]; then _filedir else + if [[ ${flags: -1} == '=' ]]; then + compopt -o nospace + fi COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) ) fi }