aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--share/completions/git.fish15
1 files changed, 11 insertions, 4 deletions
diff --git a/share/completions/git.fish b/share/completions/git.fish
index 85e7803f..4bb51961 100644
--- a/share/completions/git.fish
+++ b/share/completions/git.fish
@@ -18,13 +18,13 @@ function __fish_git_remotes
end
function __fish_git_ranges
- set from (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[0]')
- set to (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[1]')
- if [ "$from" = "" ]
+ set -l from (commandline -ot | perl -ne 'if (index($_, "..") > 0) { my @parts = split(/\.\./); print $parts[0]; }')
+ if test -z "$from"
__fish_git_branches
return 0
end
-
+
+ set -l to (commandline -ot | perl -ne 'if (index($_, "..") > 0) { my @parts = split(/\.\./); print $parts[1]; }')
for from_ref in (__fish_git_heads | grep -e "$from")
for to_ref in (__fish_git_heads | grep -e "$to")
printf "%s..%s\n" $from_ref $to_ref
@@ -146,6 +146,13 @@ complete -c git -n '__fish_git_using_command diff' -a '(__fish_git_ranges)' -d '
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
# TODO options
+### difftool
+complete -c git -n '__fish_git_needs_command' -a difftool -d 'Open diffs in a visual tool'
+complete -c git -n '__fish_git_using_command difftool' -a '(__fish_git_ranges)' -d 'Branch'
+complete -c git -n '__fish_git_using_command difftool' -l cached -d 'Visually show diff of changes in the index'
+# TODO options
+
+
### grep
complete -c git -n '__fish_git_needs_command' -a grep -d 'Print lines matching a pattern'
# TODO options