zsh-users
 help / color / mirror / code / Atom feed
* Multi-word aliases?
@ 2014-11-04  9:08 Dominik Vogt
  2014-11-04  9:56 ` Peter Stephenson
  0 siblings, 1 reply; 11+ messages in thread
From: Dominik Vogt @ 2014-11-04  9:08 UTC (permalink / raw)
  To: Zsh Users

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 <n> 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


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <20141104090838.GA27526__23771.1416128606$1415092256$gmane$org@linux.vnet.ibm.com>]

end of thread, other threads:[~2014-11-04 16:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-04  9:08 Multi-word aliases? Dominik Vogt
2014-11-04  9:56 ` Peter Stephenson
2014-11-04 10:43   ` Dominik Vogt
2014-11-04 10:59     ` Mikael Magnusson
2014-11-04 11:33       ` Dominik Vogt
2014-11-04 12:32         ` Mikael Magnusson
2014-11-04 12:39           ` Peter Stephenson
2014-11-04 12:53             ` Dominik Vogt
2014-11-04 15:57               ` Vincent Lefevre
2014-11-04 11:32     ` Peter Stephenson
     [not found] <20141104090838.GA27526__23771.1416128606$1415092256$gmane$org@linux.vnet.ibm.com>
2014-11-04 10:20 ` Stephane Chazelas

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).