diff options
author | 2013-04-04 21:36:13 -0700 | |
---|---|---|
committer | 2013-04-04 21:36:13 -0700 | |
commit | 5cebd3abf763ea3b28e42884917f2b8af6bcc473 (patch) | |
tree | 6d350827fe0955d12493abb29a80fe3b7738a28b /share/completions/git.fish | |
parent | 5ed5d637b89cf0339a6d5e8893ae67de00b69287 (diff) |
Teach git completion about difftool. Change __fish_git_ranges to output branches as designed.
Diffstat (limited to 'share/completions/git.fish')
-rw-r--r-- | share/completions/git.fish | 15 |
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 |