Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 3/3] _tilde_files: Offer named directories. Document.



---
It would be nice if the named-directories completion would use _describe
with the hash's keys as completions and its values as descriptions.

However, that's for another day.

Cheers,

Daniel


 Completion/Unix/Type/_tilde_files | 3 ++-
 Doc/Zsh/compsys.yo                | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Completion/Unix/Type/_tilde_files b/Completion/Unix/Type/_tilde_files
index ee6b180..b1b3b37 100644
--- a/Completion/Unix/Type/_tilde_files
+++ b/Completion/Unix/Type/_tilde_files
@@ -30,7 +30,8 @@ case "$PREFIX" in
   ;;
 \~*)
   compset -P '?'
-  _users "$@"
+  local -a expl=( "$@" )
+  _alternative -O expl users:user:_users named-directories:'named directory':'compadd -k nameddirs'
   ;;
 *)
   _files "$@"
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 33ba92c..4248276 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -5019,6 +5019,12 @@ allows tt(_tags) to use a more
 specific context without having to change and reset the
 tt(curcontext) parameter (which has the same effect).
 )
+findex(_tilde_files)
+item(tt(_tilde_files))(
+Like tt(_files), but resolve leading tildes according to the rules of
+filename expansion, so the suggested completions don't start with
+a `tt(~)' even if the filename on the command-line does.
+)
 findex(_values)
 item(tt(_values) [ tt(-O) var(name) ] [ tt(-s) var(sep) ] [ tt(-S) var(sep) ] [ tt(-wC) ] var(desc) var(spec) ...)(
 This is used to complete arbitrary keywords (values) and their arguments,



Messages sorted by: Reverse Date, Date, Thread, Author