Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Remove space added by completion
On Feb 14, 7:49pm, Aaron Schrab wrote:
}
} I don't know about the original poster, but one place where I often
} don't want a space after a completion is with git branch names, to make
} it easier to do commands like:
}
} # List commits in current branch but not in master
} git log master..
} # List commits from either branch which aren't in the other
} git log branch1...branch2
Try something like the following; I won't hazard to commit it because
I don't know git branch syntax well enough yet. With this diff you
should be able to complete the branch name and then type "." and it
will auto-remove the space.
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index c09f255..0c1288a 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5398,7 +5398,7 @@ __git_branch_names () {
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful $pipestatus || return 1
- _wanted branch-names expl branch-name compadd $* - $branch_names
+ _wanted branch-names expl branch-name compadd -r . $* - $branch_names
}
(( $+functions[__git_remote_branch_names] )) ||
@@ -5409,7 +5409,7 @@ __git_remote_branch_names () {
branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/})
__git_command_successful $pipestatus || return 1
- _wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names
+ _wanted remote-branch-names expl 'remote branch name' compadd -r . $* - $branch_names
}
(( $+functions[__git_remote_branch_names_noprefix] )) ||
@@ -5420,7 +5420,7 @@ __git_remote_branch_names_noprefix () {
branch_names=(${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}##*/}:#HEAD})
__git_command_successful $pipestatus || return 1
- _wanted remote-branch-names-noprefix expl 'remote branch name' compadd $* - $branch_names
+ _wanted remote-branch-names-noprefix expl 'remote branch name' compadd -r . $* - $branch_names
}
(( $+functions[__git_commits] )) ||
Messages sorted by:
Reverse Date,
Date,
Thread,
Author