From e2be71cbe4cd5f5eae3ebd9ffec90ba47e0ec860 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Fri, 19 Sep 2014 18:35:32 -0700 Subject: [PATCH] Better git alias completion Config entries that contained the word "alias" but were not in fact aliases no longer are treated as aliases. --- share/completions/git.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 9bb92a89c..0c774cd0b 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -87,6 +87,10 @@ function __fish_git_complete_stashes command git stash list --format=format:"%gd:%gs" | sed 's/:/\t/' end +function __fish_git_aliases + command git config --get-regexp '^alias\.' | sed -n "s/^alias\.\([^ ]*\).*/\1/p" +end + # general options complete -f -c git -n 'not __fish_git_needs_command' -l help -d 'Display the manual of a git command' @@ -387,4 +391,4 @@ complete -f -c git -n '__fish_git_using_command submodule' -a 'sync' -d 'Sync su complete -f -c git -n '__fish_git_needs_command' -a whatchanged -d 'Show logs with difference each commit introduces' ## Aliases (custom user-defined commands) -complete -c git -n '__fish_git_needs_command' -a '(command git config --get-regexp alias | sed "s/^alias\.\([^ ]*\).*/\1/")' -d 'Alias (user-defined command)' +complete -c git -n '__fish_git_needs_command' -a '(__fish_git_aliases)' -d 'Alias (user-defined command)'