From 568de8157a01336be9003cd4c224f9819674b914 Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Fri, 24 May 2013 14:01:47 +0200 Subject: [PATCH 1/3] added completion for git add --patch --- share/completions/git.fish | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/completions/git.fish b/share/completions/git.fish index 0df7d2c93..a275785e5 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -18,6 +18,10 @@ function __fish_git_remotes command git remote end +function __fish_git_modified_files + command git status -s | grep -e "^ M" | sed "s/^ M //" +end + function __fish_git_ranges set -l from (commandline -ot | perl -ne 'if (index($_, "..") > 0) { my @parts = split(/\.\./); print $parts[0]; }') if test -z "$from" @@ -93,6 +97,7 @@ complete -f -c git -n '__fish_git_using_command show-branch' -a '(__fish_git_hea ### add complete -c git -n '__fish_git_needs_command' -a add -d 'Add file contents to the index' +complete -f -c git -n '__fish_git_using_command add; and __fish_contains_opt -s p patch' -a (__fish_git_modified_files) # TODO options ### checkout From b8028c1b1d3137a52edf842531819a5e597d7817 Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Fri, 24 May 2013 14:10:00 +0200 Subject: [PATCH 2/3] added options for git add --- share/completions/git.fish | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/completions/git.fish b/share/completions/git.fish index a275785e5..e349e1e21 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -98,6 +98,8 @@ complete -f -c git -n '__fish_git_using_command show-branch' -a '(__fish_git_hea ### add complete -c git -n '__fish_git_needs_command' -a add -d 'Add file contents to the index' complete -f -c git -n '__fish_git_using_command add; and __fish_contains_opt -s p patch' -a (__fish_git_modified_files) +complete -f -c git -n '__fish_git_using_command add' -s p -d 'Interactively add hunks to staging area' +complete -f -c git -n '__fish_git_using_command add' -s u -d 'Update already tracked files' # TODO options ### checkout From 2997ce2e3ce516d89356beb3f824051162846273 Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Fri, 24 May 2013 15:09:57 +0200 Subject: [PATCH 3/3] quote command for it to be ran every time --- share/completions/git.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index e349e1e21..c7c7bb16e 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -97,7 +97,7 @@ complete -f -c git -n '__fish_git_using_command show-branch' -a '(__fish_git_hea ### add complete -c git -n '__fish_git_needs_command' -a add -d 'Add file contents to the index' -complete -f -c git -n '__fish_git_using_command add; and __fish_contains_opt -s p patch' -a (__fish_git_modified_files) +complete -f -c git -n '__fish_git_using_command add; and __fish_contains_opt -s p patch' -a '(__fish_git_modified_files)' complete -f -c git -n '__fish_git_using_command add' -s p -d 'Interactively add hunks to staging area' complete -f -c git -n '__fish_git_using_command add' -s u -d 'Update already tracked files' # TODO options