Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _generic
- X-seq: zsh-workers 11872
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: _generic
- Date: Tue, 13 Jun 2000 13:54:01 +0200 (MET DST)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Felix suggested something like this some time ago. I think there were
more suggestions, but I can't find the message anymore.
Anyway, maybe this is an acceptable start... _generic puts $WIDGET in
the function field of the context and calls _main_complete. I.e. it
allows users to (relatively) easily define custom completion widgets
for which different styles can be set.
Bye
Sven
Index: Completion/Commands/_generic
===================================================================
RCS file: _generic
diff -N _generic
--- /dev/null Tue May 5 13:32:27 1998
+++ _generic Tue Jun 13 04:53:24 2000
@@ -0,0 +1,11 @@
+#autoload
+
+local curcontext="$curcontext"
+
+if [[ -z "$curcontext" ]]; then
+ curcontext="${WIDGET}:::"
+else
+ curcontext="${WIDGET}:${curcontext#*:}"
+fi
+
+_main_complete
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.62
diff -u -r1.62 compsys.yo
--- Doc/Zsh/compsys.yo 2000/06/13 11:45:26 1.62
+++ Doc/Zsh/compsys.yo 2000/06/13 11:53:26
@@ -2452,6 +2452,20 @@
value for the tt(substitute) and tt(glob) styles, so both types of
expansion will normally be performed.
)
+findex(_generic)
+item(tt(_generic))(
+This function is not defined as a widget and not bound by
+default. However, it can be used to define a widget and will then
+store the name of the widget in the var(function) field of the context
+and call the completion system. This allows to easily define custom
+completion widgets with their own sets of style settings. For example,
+to define a widget that does normal completion and starts
+menu-selection, one could do:
+
+example(zle -C foo complete-word _generic
+bindkey '...' foo
+zstyle ':completion:foo:*' menu yes select=1)
+)
findex(_history_complete_word) (\e/))
item(tt(_history_complete_word) (\e/))(
Complete words from the shell's command history. This uses the
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author