From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18594 invoked by alias); 4 Nov 2014 09:08:59 -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: 19332 Received: (qmail 6778 invoked from network); 4 Nov 2014 09:08:48 -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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.2 Date: Tue, 4 Nov 2014 10:08:38 +0100 From: Dominik Vogt To: Zsh Users Subject: Multi-word aliases? Message-ID: <20141104090838.GA27526@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: Zsh Users MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14110409-0013-0000-0000-000001B97FD1 Background: ----------- Using git, I want to automatically switch on certain command line options for certain git subcommands. For example, "git rebase" should *always* be silently replaced by "git rebase --keep-empty". git-config does not help here, because it cannot set the --keep-empty option. Now, the shell already has an aliasing mechanism. For "normal" commands it would be just somethins like "alias ls='ls -F'" For now I've settled with a suboptimal approach using alises: # force treating the second argument like a command alias git="git " # aliasing rule for the first argument of git commands alias rebase="rebase --keep-empty" Of course this can have nasty side effects, but it may be good enough for my immediate task. Question: --------- Is there a way to define "multi word" aliases, i.e. to force zsh to look at the first words for aliasing, not just at the word in command position? What I mean is something like this: alias "echo foo"="echo foo bar" $ echo foo foo bar That would allow to solve this class of problems without help from the application. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany