Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Show alias values in command completions
Show the value of each alias when descriptions are shown. Enabled by default.
---
Completion/Zsh/Type/_command_names | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names
index 12cbd69c1..d445be06e 100644
--- a/Completion/Zsh/Type/_command_names
+++ b/Completion/Zsh/Type/_command_names
@@ -4,7 +4,7 @@
# complete only external commands and executable files. This and a
# `-' as the first argument is then removed from the arguments.
-local args defs expl ffilt
+local args defs expl ffilt verbose
zstyle -t ":completion:${curcontext}:commands" rehash && rehash
@@ -33,13 +33,19 @@ else
defs=( "$defs[@]"
'builtins:builtin command:compadd -Qk builtins'
"functions:shell function:compadd -k 'functions$ffilt'"
- 'aliases:alias:compadd -Qk aliases'
'suffix-aliases:suffix alias:_suffix_alias_files'
'reserved-words:reserved word:compadd -Qk reswords'
'jobs:: _jobs -t'
'parameters:: _parameters -g "^*(readonly|association)*" -qS= -r "\n\t\- =[+"'
'parameters:: _parameters -g "*association*~*readonly*" -qS\[ -r "\n\t\- =[+"'
)
+
+ if zstyle -T ":completion:${curcontext}:aliases" verbose; then
+ printf -v verbose %s:%s\ ${(@q+)${(kv)aliases}[@]//\:/\\:}
+ defs+=( "aliases:alias:(( $verbose ))" )
+ else
+ defs+=( 'aliases:alias:compadd -Qk aliases' )
+ fi
fi
args=( "$@" )
--
2.39.2 (Apple Git-143)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author