zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH 1/3] Make a helper function global.
Date: Sun, 16 Oct 2016 17:14:48 +0000	[thread overview]
Message-ID: <1476638090-1551-1-git-send-email-danielsh@fujitsu.shahaf.local2> (raw)

---
 Completion/Zsh/Command/_zstyle  | 16 ----------------
 Completion/Zsh/Type/_completers | 14 ++++++++++++++
 Doc/Zsh/compsys.yo              | 10 ++++++++++
 3 files changed, 24 insertions(+), 16 deletions(-)
 create mode 100644 Completion/Zsh/Type/_completers

diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index 20ff47f..dcebc6f 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -4,22 +4,6 @@ local state context ostate line expl ctop suf
 local nm=$compstate[nmatches] taglist patterns pstyles contexts
 typeset -A opt_args styles
 
-(( $+functions[_completers] )) ||
-_completers() {
-  # option: -p - needs a `_' prefix
-  local us
-  local -a disp list expl
-
-  list=( complete approximate correct match expand list menu oldlist
-         ignored prefix history )
-  zparseopts -D -K -E 'p=us'
-  [[ -n "$us" ]] && us='_'
-  zstyle -t ":completion:${curcontext}:completers" prefix-hidden &&
-      disp=(-d list)
-  _wanted completers expl 'completer' \
-      compadd "$@" "$disp[@]" - "$us${^list[@]}"
-}
-
 _vcs_info_hooks() {
   compadd - ${functions[(I)+vi-*]#+vi-}
 }
diff --git a/Completion/Zsh/Type/_completers b/Completion/Zsh/Type/_completers
new file mode 100644
index 0000000..87c986a
--- /dev/null
+++ b/Completion/Zsh/Type/_completers
@@ -0,0 +1,14 @@
+#autoload
+
+# option: -p - needs a `_' prefix
+local us
+local -a disp list expl
+
+list=( complete approximate correct match expand list menu oldlist
+       ignored prefix history )
+zparseopts -D -K -E 'p=us'
+[[ -n "$us" ]] && us='_'
+zstyle -t ":completion:${curcontext}:completers" prefix-hidden &&
+    disp=(-d list)
+_wanted completers expl 'completer' \
+    compadd "$@" "$disp[@]" - "$us${^list[@]}"
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 260ace4..a56ca67 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -4246,6 +4246,16 @@ This function completes words that are valid at command position: names of
 aliases, builtins, hashed commands, functions, and so on.  With the tt(-e)
 flag, only hashed commands are completed.  The tt(-) flag is ignored.
 )
+findex(_completers)
+item(tt(_completers) [ tt(-p) ])(
+This function completes names of completers.
+
+startitem()
+item(tt(-p))(
+Include the leading underscore (`tt(_)') in the matches.
+)
+enditem()
+)
 findex(_describe)
 redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ ))ifnztexi(          )))
 xitem(tt(_describe )[tt(-12JVx)] [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] [ var(opt) ... ])


             reply	other threads:[~2016-10-16 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-16 17:14 Daniel Shahaf [this message]
2016-10-16 17:14 ` [PATCH 2/3] _zstyle: When completing a style for an unrecognised context, complete all known styles Daniel Shahaf
2016-10-16 17:14 ` [PATCH 3/3] _zstyle: Complete the -g, -s,-b,-a, -t,-T, -m options Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476638090-1551-1-git-send-email-danielsh@fujitsu.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).