about summary refs log tree commit diff
path: root/Doc
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-06-24 10:40:23 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-06-27 00:53:02 +0000
commit7f58463dd33cfd75af894ba30fcbda576c112e46 (patch)
tree9bc848ae881911a9d6c62a4384256bb29cd482a3 /Doc
parent4e3d08fea8b82a638211b02fbaa7772cf1b2863d (diff)
downloadzsh-7f58463dd33cfd75af894ba30fcbda576c112e46.tar.gz
zsh-7f58463dd33cfd75af894ba30fcbda576c112e46.tar.xz
zsh-7f58463dd33cfd75af894ba30fcbda576c112e46.zip
users/24959/0001: Extend documentation of global aliases.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Zsh/builtins.yo8
-rw-r--r--Doc/Zsh/grammar.yo9
2 files changed, 16 insertions, 1 deletions
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index ada69c99a..d35cad182 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -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
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index a4e0c1121..7eabd75ce 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -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.