From 70411169809410901ba6f90b668a69eec2002003 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 20 Jan 2000 09:15:32 +0000 Subject: zsh-workers/9383 --- Completion/Builtins/_zstyle | 2 ++ Completion/Core/_path_files | 8 +++++++ Doc/Zsh/compsys.yo | 55 ++++++++++++++++++++++++--------------------- 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle index 07bfd2976..2e95545c2 100644 --- a/Completion/Builtins/_zstyle +++ b/Completion/Builtins/_zstyle @@ -18,6 +18,7 @@ styles=( cursor c:bool disable-stat c:bool expand c: + file-patterns c: format c: glob c: group-name c: @@ -49,6 +50,7 @@ styles=( sort c:bool tag-order c:tag special-dirs c:sdirs + squeeze-slashes c:bool stop c:stop substitute c: users c:_users diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index e76a54882..9c1be30bf 100644 --- a/Completion/Core/_path_files +++ b/Completion/Core/_path_files @@ -157,6 +157,14 @@ if zstyle -s ":completion${curcontext}:files" sort tmp1; then 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. diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 863689afc..f1ad79fab 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -1160,6 +1160,36 @@ to tt(menu), then the expansions are only sorted when they are offered 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. @@ -1196,31 +1226,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 a username is needed. If it is not set or the string on the line -- cgit 1.4.1