better files completion in git repo
This commit is contained in:
parent
08459c6382
commit
b2785649c8
5
bashrc
5
bashrc
@ -40,6 +40,9 @@ _comp_git() {
|
|||||||
# remotes
|
# remotes
|
||||||
COMPREPLY+=( $(git remote | grep "^$2") )
|
COMPREPLY+=( $(git remote | grep "^$2") )
|
||||||
|
|
||||||
|
# files
|
||||||
|
COMPREPLY+=( $(git ls-files -co --exclude-standard | grep "^$2") )
|
||||||
|
|
||||||
# subcommands
|
# subcommands
|
||||||
if [ "$3" = "git" ]; then
|
if [ "$3" = "git" ]; then
|
||||||
COMPREPLY+=( $({ compgen -c "git-"; command ls /usr/libexec/git-core; } | sed -n 's/^git-//p' | grep "^$2") )
|
COMPREPLY+=( $({ compgen -c "git-"; command ls /usr/libexec/git-core; } | sed -n 's/^git-//p' | grep "^$2") )
|
||||||
@ -50,7 +53,7 @@ complete -c man
|
|||||||
complete -cf sudo
|
complete -cf sudo
|
||||||
complete -cf exec
|
complete -cf exec
|
||||||
complete -cf run
|
complete -cf run
|
||||||
complete -fF _comp_git git
|
complete -F _comp_git git
|
||||||
|
|
||||||
# history
|
# history
|
||||||
export HISTCONTROL=ignorespace:erasedups
|
export HISTCONTROL=ignorespace:erasedups
|
||||||
|
Loading…
Reference in New Issue
Block a user