diff --git a/profile.d/bash-completion/git-completion.sh b/profile.d/bash-completion/git-completion.sh index df8ce27..be3972b 100644 --- a/profile.d/bash-completion/git-completion.sh +++ b/profile.d/bash-completion/git-completion.sh @@ -56,6 +56,21 @@ _profile_git_complete_refs() COMPREPLY=( $(compgen -W "$(git for-each-ref --format='%(refname:short)' refs/heads refs/remotes refs/tags 2>/dev/null)" -- "$cur") ) } +_profile_git_complete_add_paths() +{ + local complete_opt="--others --modified --directory --no-empty-directory" + + if declare -F __git_complete_index_file >/dev/null 2>&1; then + if [[ -n $(__git_find_on_cmdline "-u --update") ]]; then + complete_opt="--modified" + fi + __git_complete_index_file "$complete_opt" + return 0 + fi + + COMPREPLY=( $(compgen -f -- "${COMP_WORDS[COMP_CWORD]}") ) +} + _complete_gst() { local cur @@ -118,7 +133,7 @@ _complete_gacp() return 0 fi - COMPREPLY=( $(compgen -f -- "$cur") ) + _profile_git_complete_add_paths } _complete_greset()