From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10132 invoked by alias); 4 Nov 2014 10:59:16 -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: 19337 Received: (qmail 18304 invoked from network); 4 Nov 2014 10:59:15 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=YX+EMVHwnr9g3eYk0shLTO3uvuWQT9oF7L7Z53jytiY=; b=pFyY55K/qC87mCbBAELu6Sie1C/StMUEBBMRiZoQW7iOuOboN1vUY/rA41HaX/zWmj MPk1/SMg5GtGmRzRLYlh/tT87WfefBRWZtzv1JGv3uXdN1mYVP348RDFIb6UBk+U75ER 958OVj/nM8ZbzDpUYKp7wpHzzm+kGqcDnz8+f5IrJXajmmBX8TnR3eg/OdbD8lfWxRlq 43gJfisPDPmQyTUNXmC7AekTJ5PdeSC/71iJFonmpbWE8fzfooh7w9dLw30OKnkBz8o6 /91hxtr7WEb54DCRq+tDBgUJ+bOdowabF4P5REl/DUg5bgsmVMxErD8PlT34Jafm8WfW xa8g== MIME-Version: 1.0 X-Received: by 10.50.4.35 with SMTP id h3mr22925656igh.37.1415098749548; Tue, 04 Nov 2014 02:59:09 -0800 (PST) In-Reply-To: <20141104104339.GA6255@linux.vnet.ibm.com> References: <20141104090838.GA27526@linux.vnet.ibm.com> <20141104095650.3f198112@pwslap01u.europe.root.pri> <20141104104339.GA6255@linux.vnet.ibm.com> Date: Tue, 4 Nov 2014 11:59:09 +0100 Message-ID: Subject: Re: Multi-word aliases? From: Mikael Magnusson To: vogt@linux.vnet.ibm.com, Zsh Users Content-Type: text/plain; charset=UTF-8 On Tue, Nov 4, 2014 at 11:43 AM, Dominik Vogt wrote: > On Tue, Nov 04, 2014 at 09:56:50AM +0000, Peter Stephenson wrote: >> > 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" > >> I haven't tried myself, but presumably you tried >> >> git config --global alias.rebase "rebase --keep-empty" > > According to the man page, you can only define new aliases, not > overwrite subcommands. > > $ man git-config > ... > To avoid confusion and troubles with script usage, aliases that > hide existing git commands are ignored. Is there a strong reason you don't want to write "git rk" or whatever at the command line? I'm quite lazy with typing so I have a set of aliases like git rc, git rs for --continue, --skip, and git amend for git commit --amend. As for the global command line regex replace, yes, you can do that if you hook into the accept-line family of widgets but there's a huge caveat; it will only do literal replacements (obviously), so if you want to respect any form of quoting you'll have to reimplement the full zsh parser in shell script which is probably not fun (eg, to avoid replacing it in git commit -m "git rebase is very useful"). The wrapper function Peter mentioned is a much saner alternative here :). -- Mikael Magnusson