zsh-users
 help / color / mirror / code / Atom feed
From: Bruce Stephens <b.stephens@isode.com>
To: ZSH users mailing list <zsh-users@math.gatech.edu>
Subject: Re: Command alias in non-command position
Date: 26 Aug 1998 17:35:05 +0100	[thread overview]
Message-ID: <vbk93v8zwm.fsf@snake.isode.com> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of "Wed, 26 Aug 1998 19:42:39 +0400"

"Andrej Borsenkow" <borsenkow.msk@sni.de> writes:

> I have some often used aliases, e.g. 
> 
> vi=elvis
> view='elvis -R'
> etc
> 
> Unfortunately, if I try to do e.g.
> 
> sudo vi ...
> 
> The /usr/bin/vi is started instead of elvis.
> 
> Is there any easy way to use my lovely aliases in this case?

An obvious immediate approach would be to use global aliases:

	alias -g vi=elvis

Then vi will expand to elvis in lots of places, so "sudo vi" will run
elvis.  But "echo vi" will also print elvis, so perhaps this is too
pervasive.  Could I define sudo somehow, to say that its first
argument ought to be expanded as if it were in the command position?
(As a function, maybe?)

Is this a case for configurable expansion?  (I already think I ought
to be able to change how spell-correction works, to say that some
words just don't correspond to files (like the first argument to tar),
and possibly to say that some words ought to correspond to
non-existent files.  This feels like a related feature.)


  reply	other threads:[~1998-08-26 16:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-26 15:42 Andrej Borsenkow
1998-08-26 16:35 ` Bruce Stephens [this message]
1998-08-26 17:01   ` Zefram
1998-08-26 17:13     ` Bruce Stephens
1998-08-26 17:26       ` Andrej Borsenkow
1998-08-26 17:49       ` Bart Schaefer
1998-08-26 17:36   ` Bart Schaefer
1998-08-27  1:51     ` 'man' completion Gossamer
1998-08-27  9:14       ` Bruce Stephens
1998-08-27 17:09         ` Bart Schaefer
1998-08-28 16:42           ` Sven Guckes
1998-08-28 17:58             ` Bart Schaefer
1998-08-30 17:03               ` maillist archive lacking search engine Sven Guckes
1998-09-01 12:51     ` Command alias in non-command position Wayne Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vbk93v8zwm.fsf@snake.isode.com \
    --to=b.stephens@isode.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).