Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion after //
- X-seq: zsh-workers 9383
- From: Alexandre Duret-Lutz <duret_g@xxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: completion after //
- Date: 20 Jan 2000 10:12:26 +0100
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: Sven Wischnowsky's message of "Wed, 19 Jan 2000 17:42:39 +0100 (MET)"
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <200001191642.RAA19840@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
>>> "Sven" == Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:
[...]
Sven> I fear it will mess up completion inside braces (only if both multiple
Sven> slashes and braces are used at the same time), but: try it. Using a
Sven> style for it, of course ;-)
[...]
Here is the patch that add a squeeze-slashes style for that.
I couldn't find any problem with braces completion, but maybe I wasn't
looking the right direction.
Index: Doc/Zsh/compsys.yo
--- Doc/Zsh/compsys.yo Wed, 19 Jan 2000 21:50:19 +0100 Alexandre
+++ Doc/Zsh/compsys.yo Thu, 20 Jan 2000 10:09:48 +0100 Alexandre
@@ -1160,6 +1160,36 @@
as single strings (not in the string containing all possible
expansions).
)
+item(tt(special-dirs))(
+Normally, the completion code will not produce the directory names
+tt(.) and tt(..) as possible completions. If this style is set to
+`true', it will add both `tt(.)' and `tt(..)' as possible completions,
+if it is set to tt(..), only `tt(..)' will be added.
+)
+item(tt(squeeze-slashes))(
+If set to `true', sequences of slashes (such as tt(foo//bar)) will
+be rewritten with a single slash (tt(foo/bar)) when completing
+directory names.
+)
+item(tt(stop))(
+If set to `true', the tt(_history_complete_word) bindable
+command will always insert matches as if menucompletion were started
+and it will stop when the last match is inserted. If this style is set
+to tt(verbose) a message will be displayed when the last match is reached.
+)
+item(tt(substitute))(
+If this is unset or set to the empty string, the tt(_expand) completer
+will first try to expand all substitutions in the string (such as
+`tt($LPAR()...RPAR())' and `tt(${...})'). If this is set to an
+non-empty string it should be an expression usable inside a `tt($((...)))'
+arithmetical expression. In this case, expansion of substitutions will
+be done if the expression evaluates to `tt(1)'. For example, with
+
+example(zstyle ':completion:expand' substitute '${NUMERIC:-1} != 1')
+
+substitution will be performed only if given an explicit numeric
+argument other than `tt(1)', as by typing `tt(ESC 2 TAB)'.
+)
item(tt(tag-order))(
This provides a mechanism for sorting how the tags available in a
particular context will be used.
@@ -1195,31 +1225,6 @@
of how such functions can be implemented.
If no style has been defined for a context, all tags will be used.
-)
-item(tt(special-dirs))(
-Normally, the completion code will not produce the directory names
-tt(.) and tt(..) as possible completions. If this style is set to
-`true', it will add both `tt(.)' and `tt(..)' as possible completions,
-if it is set to tt(..), only `tt(..)' will be added.
-)
-item(tt(stop))(
-If set to `true', the tt(_history_complete_word) bindable
-command will always insert matches as if menucompletion were started
-and it will stop when the last match is inserted. If this style is set
-to tt(verbose) a message will be displayed when the last match is reached.
-)
-item(tt(substitute))(
-If this is unset or set to the empty string, the tt(_expand) completer
-will first try to expand all substitutions in the string (such as
-`tt($LPAR()...RPAR())' and `tt(${...})'). If this is set to an
-non-empty string it should be an expression usable inside a `tt($((...)))'
-arithmetical expression. In this case, expansion of substitutions will
-be done if the expression evaluates to `tt(1)'. For example, with
-
-example(zstyle ':completion:expand' substitute '${NUMERIC:-1} != 1')
-
-substitution will be performed only if given an explicit numeric
-argument other than `tt(1)', as by typing `tt(ESC 2 TAB)'.
)
item(tt(users))(
This may be set to a list of names that should be completed whenever
Index: Completion/Core/_path_files
--- Completion/Core/_path_files Wed, 19 Jan 2000 21:50:19 +0100 Alexandre
+++ Completion/Core/_path_files Thu, 20 Jan 2000 09:47:19 +0100 Alexandre
@@ -157,6 +157,14 @@
fi
fi
+# Squeeze sequences of slashes
+if zstyle -t ":completion${curcontext}:paths" squeeze-slashes
+then
+ PREFIX="${PREFIX//(\\/)#//}"
+ SUFFIX="${SUFFIX//(\\/)#//}"
+ [[ $PREFIX = */ ]] && SUFFIX=${SUFFIX#/}
+fi
+
# We get the prefix and the suffix from the line and save the whole
# original string. Then we see if we will do menucompletion.
Index: Completion/Builtins/_zstyle
--- Completion/Builtins/_zstyle Fri, 14 Jan 2000 10:25:34 +0100 Alexandre
+++ Completion/Builtins/_zstyle Thu, 20 Jan 2000 10:10:04 +0100 Alexandre
@@ -18,6 +18,7 @@
cursor c:bool
disable-stat c:bool
expand c:
+ file-patterns c:
format c:
glob c:
group-name c:
@@ -49,6 +50,7 @@
sort c:bool
tag-order c:tag
special-dirs c:sdirs
+ squeeze-slashes c:bool
stop c:stop
substitute c:
users c:_users
--
Alexandre Duret-Lutz
Messages sorted by:
Reverse Date,
Date,
Thread,
Author