Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Command alias in non-command position



On Aug 26,  5:35pm, Bruce Stephens wrote:
} Subject: Re: Command alias in non-command position
}
} > sudo vi ...
} > 
} > The /usr/bin/vi is started instead of elvis.
} > 
} > Is there any easy way to use my lovely aliases in this case?
} 
} Could I define sudo somehow, to say that its first argument ought to
} be expanded as if it were in the command position?

Yes:

alias sudo='sudo '

The trailing space in the sudo alias tells zsh to also apply alias
expansion again to the next word that follows it.

} 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.

Programmable spelling correction would be the next logical step after
programmable completion, I suppose.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author