1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

users/24959/0001: Extend documentation of global aliases.

This commit is contained in:
Daniel Shahaf 2020-06-24 10:40:23 +00:00
parent 4e3d08fea8
commit 7f58463dd3
3 changed files with 21 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2020-06-27 Daniel Shahaf <d.s@daniel.shahaf.name>
* users/24959/0001: Doc/Zsh/builtins.yo, Doc/Zsh/grammar.yo:
Extend documentation of global aliases.
2020-06-26 Daniel Shahaf <d.s@daniel.shahaf.name>
* unposted: Doc/Zsh/contrib.yo, Doc/Zsh/expn.yo,

View file

@ -105,7 +105,13 @@ For each var(name) with a corresponding var(value), define an alias
with that value. A trailing space in var(value) causes the next word
to be checked for alias expansion. If the tt(-g) flag is present,
define a global alias; global aliases are expanded even if they do not
occur in command position.
occur in command position:
example(% perldoc --help 2>&1 | grep 'built-in functions'
-f Search Perl built-in functions
% alias -g HG='--help 2>&1 | grep'
% perldoc HG 'built-in functions'
-f Search Perl built-in functions)
If the tt(-s) flag is present, define a suffix alias: if the command
word on a command line is in the form `var(text)tt(.)var(name)', where

View file

@ -597,6 +597,15 @@ word, e.g. tt(\foo). Any form of quoting works, although there is
nothing to prevent an alias being defined for the quoted form such as
tt(\foo) as well.
In particular, note that quoting must be used when using tt(unalias) to remove
global aliases:
example(% alias -g foo=bar
% unalias foo
unalias: no such hash table element: bar
% unalias \foo
% )
When tt(POSIX_ALIASES) is set, only plain unquoted strings are eligible
for aliasing. The tt(alias) builtin does not reject ineligible aliases,
but they are not expanded.