Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: alias -g -> SOLVED
- X-seq: zsh-users 15254
- From: Eric Smith <es@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: alias -g -> SOLVED
- Date: Fri, 6 Aug 2010 13:33:14 +0200
- In-reply-to: <100804083151.ZM7810@xxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20100803191028.GA16019@xxxxxxxxxxxxx> <20100803193709.GA1012@xxxxxxxxxxxx> <mailbox-24032-1280865621-62794@pepper> <100804083151.ZM7810@xxxxxxxxxxxxxxxxxxxxxx>
NICE
Thanks Bart
- Eric Smith
> However, you may be able to get what you want via preexec_functions.
>
> auto_translate() {
> local -a commandline
> commandline=( ${(z)1} )
> if [[ $commandline[-1] == T ]]
> then
> print -R "${commandline[0,-2]}" | translate
> fi
> }
>
> # Important that this comes after function definition
> alias -g T='${auto_translate?command execution suppressed}'
>
> # Set auto_translate to the empty string to both translate
> # and then execute the original command anyway
> unset auto_translate # Force T alias to abort
> preexec_functions+=( auto_translate )
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author