* [PATCH] _git: Autocomplete .. for commit ranges
@ 2015-11-18 23:15 Daniel Shahaf
0 siblings, 0 replies; only message in thread
From: Daniel Shahaf @ 2015-11-18 23:15 UTC (permalink / raw)
To: zsh-workers; +Cc: Matthew Martin, Oliver Kiddle
This patch makes three changes:
- Enable 'git diff o/m<TAB>' to complete to 'origin/master..' with the
".." being autoremovable.
This is implemented by the first hunk. That hunk is a functional
subset of Oliver's users/20705, however, the latter hasn't been
committed.
- Make typing "^" remove the "..", in light of the syntax "foo^..bar".
- Make typing "." _not_ remove the ".." but simply append it, since
"foo...bar" is a valid and useful syntax.
---
I'm not sure why the ^ needs escaping there — ^ is not special in character
classes when not in first position.
I think this can be further improved, for example, in 'git log
o/m<TAB>--' (for a 'git log HEAD -- file.c' syntax) typing the '-'
should remove the "..".
Cheers,
Daniel
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index ad1037e..ac3e152 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5597,8 +5597,8 @@ __git_commits () {
(( $+functions[__git_heads] )) ||
__git_heads () {
- __git_heads_local
- __git_heads_remote
+ __git_heads_local "$@"
+ __git_heads_remote "$@"
}
(( $+functions[__git_heads_local] )) ||
@@ -5786,7 +5786,7 @@ __git_commit_ranges () {
if [[ ${PREFIX} = (#b)((\\|)\^)* ]]; then
compset -p ${#match[1]}
else
- suf=( -S .. -r '.@~ ^:\t\n\-' )
+ suf=( -S .. -r '@~ \^:\t\n\-' )
fi
fi
expl=( $* $suf )
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-11-18 23:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 23:15 [PATCH] _git: Autocomplete .. for commit ranges Daniel Shahaf
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).