From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2580 invoked by alias); 28 Sep 2010 06:09:08 -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: 15434 Received: (qmail 3212 invoked from network); 28 Sep 2010 06:09:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at biskalar.de does not designate permitted sender hosts) References: In-Reply-To: Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii Message-Id: Content-Transfer-Encoding: quoted-printable Cc: Conrad Irwin , zsh-users@zsh.org From: Sebastian Stark Subject: Re: _git Completion and custom commands Date: Tue, 28 Sep 2010 07:28:02 +0200 To: Benjamin R. Haskell X-Mailer: Apple Mail (2.1081) Am 28.09.2010 um 06:06 schrieb Benjamin R. Haskell: >> My question is then: how would I add my custom commands' names to the = list already completed by _git (without completely overriding or = modifying the system-wide configuration)? >=20 > This has bothered me for a while, too. I think _git should include = these by default. But, it's pretty easy to add: >=20 > zstyle ':completion:*:git:*' user-commands = ${${(k)commands[(I)git-*]}#git-} >=20 > (I've found _git to be very about what it allows you to override via = zstyles) >=20 > Explanation of the '${${(k)commands[(I)git-*]}#git-}' portion: >=20 > $commands is a built-in associative array that maps basenames to their = full paths. >=20 > E.g. one of my custom git- commands that it picks up is: > commands[git-build-zsh]=3D/home/bhaskell/bin/git-build-zsh >=20 > So, we're looking for the keys '(k)'. And we only want entries in the = hash that have (I)ndexes matching 'git-*'. Then we want to remove the = leading 'git-' portion ( ${...#git-} ). All this is just because then you can type "git bu" instead of = "git-bu"? Or is there more to it? Perhaps I do not understand. Sebastian=