* Alias named '='
@ 2017-10-08 8:03 René Neumann
2017-10-08 8:29 ` Vincent Bernat
0 siblings, 1 reply; 5+ messages in thread
From: René Neumann @ 2017-10-08 8:03 UTC (permalink / raw)
To: Zsh Users
Hi all,
I stumbled upon the idea to define a function '=' to have an inline
calculator in zsh [1].
As multiplication is a normal operation, I also want 'noglob' behavior.
There seems to be no way of defining this for a function (or is there?),
so the only way would be to haven an alias
alias '='='noglob ='
But this seems to not be possible, yielding 'bad assignment': The alias
command seems to hard-parse until the first equal-sign -- even tricks like
alias $'\u3D'='noglob ='
do not work.
Does anyone know a trick that could be used here?
Best regards,
René
[1] https://github.com/arzzen/calc.plugin.zsh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Alias named '='
2017-10-08 8:03 Alias named '=' René Neumann
@ 2017-10-08 8:29 ` Vincent Bernat
2017-10-08 10:57 ` René Neumann
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Bernat @ 2017-10-08 8:29 UTC (permalink / raw)
To: René Neumann; +Cc: Zsh Users
❦ 8 octobre 2017 10:03 +0200, René Neumann <lists@necoro.eu> :
> I stumbled upon the idea to define a function '=' to have an inline
> calculator in zsh [1].
>
> As multiplication is a normal operation, I also want 'noglob' behavior.
> There seems to be no way of defining this for a function (or is there?),
> so the only way would be to haven an alias
> alias '='='noglob ='
>
> But this seems to not be possible, yielding 'bad assignment': The alias
> command seems to hard-parse until the first equal-sign -- even tricks like
> alias $'\u3D'='noglob ='
> do not work.
I am using "c" instead of "=", but you can use "=" with:
aliases[=]='noglob ='
--
Use the "telephone test" for readability.
- The Elements of Programming Style (Kernighan & Plauger)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Alias named '='
2017-10-08 8:29 ` Vincent Bernat
@ 2017-10-08 10:57 ` René Neumann
2017-10-08 18:37 ` Daniel Shahaf
0 siblings, 1 reply; 5+ messages in thread
From: René Neumann @ 2017-10-08 10:57 UTC (permalink / raw)
To: Vincent Bernat; +Cc: Zsh Users
Am 08.10.2017 um 10:29 schrieb Vincent Bernat:
> ❦ 8 octobre 2017 10:03 +0200, René Neumann <lists@necoro.eu> :
>
>> I stumbled upon the idea to define a function '=' to have an inline
>> calculator in zsh [1].
>>
>> As multiplication is a normal operation, I also want 'noglob' behavior.
>> There seems to be no way of defining this for a function (or is there?),
>> so the only way would be to haven an alias
>> alias '='='noglob ='
>>
>> But this seems to not be possible, yielding 'bad assignment': The alias
>> command seems to hard-parse until the first equal-sign -- even tricks like
>> alias $'\u3D'='noglob ='
>> do not work.
>
> I am using "c" instead of "=", but you can use "=" with:
>
> aliases[=]='noglob ='
>
Ah, thanks! That worked.
- René
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-08 23:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08 8:03 Alias named '=' René Neumann
2017-10-08 8:29 ` Vincent Bernat
2017-10-08 10:57 ` René Neumann
2017-10-08 18:37 ` Daniel Shahaf
2017-10-08 22:37 ` Ray Andrews
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).