Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Multi-word aliases?
- X-seq: zsh-users 19337
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: vogt@xxxxxxxxxxxxxxxxxx, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Multi-word aliases?
- Date: Tue, 4 Nov 2014 11:59:09 +0100
- 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==
- In-reply-to: <20141104104339.GA6255@linux.vnet.ibm.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20141104090838.GA27526@linux.vnet.ibm.com> <20141104095650.3f198112@pwslap01u.europe.root.pri> <20141104104339.GA6255@linux.vnet.ibm.com>
On Tue, Nov 4, 2014 at 11:43 AM, Dominik Vogt <vogt@xxxxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author