From b2785649c82d8d5be67db801c2859b11cbafd34d Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Tue, 17 Oct 2017 10:07:22 +0200 Subject: [PATCH] better files completion in git repo --- bashrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 3558f71..348c970 100644 --- a/bashrc +++ b/bashrc @@ -40,6 +40,9 @@ _comp_git() { # remotes COMPREPLY+=( $(git remote | grep "^$2") ) + # files + COMPREPLY+=( $(git ls-files -co --exclude-standard | grep "^$2") ) + # subcommands if [ "$3" = "git" ]; then 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 exec complete -cf run -complete -fF _comp_git git +complete -F _comp_git git # history export HISTCONTROL=ignorespace:erasedups