From 21759ab1dd1a240bedd4e7f15e1734d1c59bf59f Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Fri, 20 Oct 2017 10:01:25 +0200 Subject: [PATCH] this works better if there are a lot of files --- bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 348c970..a5bf4af 100644 --- a/bashrc +++ b/bashrc @@ -41,7 +41,7 @@ _comp_git() { COMPREPLY+=( $(git remote | grep "^$2") ) # files - COMPREPLY+=( $(git ls-files -co --exclude-standard | grep "^$2") ) + COMPREPLY+=( $(git ls-files -co --exclude-standard "$2*" | sed "s?\($2[^/]*\).*?\1?") ) # subcommands if [ "$3" = "git" ]; then @@ -53,7 +53,7 @@ complete -c man complete -cf sudo complete -cf exec complete -cf run -complete -F _comp_git git +complete -o filenames -F _comp_git git # history export HISTCONTROL=ignorespace:erasedups