From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26649 invoked by alias); 15 Feb 2014 02:33:34 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18458 Received: (qmail 12821 invoked from network); 15 Feb 2014 02:33:27 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140214183336.ZM10372@torch.brasslantern.com> Date: Fri, 14 Feb 2014 18:33:36 -0800 In-reply-to: <20140215004907.GH10654@pug.qqx.org> Comments: In reply to Aaron Schrab "Re: Remove space added by completion" (Feb 14, 7:49pm) References: <16835.1392415885@thecus.kiddle.eu> <20140215004907.GH10654@pug.qqx.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Remove space added by completion MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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] )) ||