From 1f290a3e8277347a782a7766948aab47c10120c8 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 3 Mar 2014 12:08:45 +0100 Subject: 32439: add new show-ambiguity style --- Doc/Zsh/compsys.yo | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Doc/Zsh') diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index c304461e2..5a5e61996 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -2440,6 +2440,15 @@ completing words for the dict command. It allows words from different dictionary databases to be added separately. The default for this style is `false'. ) +kindex(show-ambiguity, completion style) +item(tt(show-ambiguity))( +If the tt(zsh/complist) module is loaded, this style can be used to +highlight the first ambiguous character in completion lists. The +value is either a color indication such as those supported by the +tt(list-colors) style or, with a value of tt(true), a default of +underlining is selected. The highlighting is only applied if the +completion display strings correspond to the actual matches. +) kindex(show-completer, completion style) item(tt(show-completer))( Tested whenever a new completer is tried. If it is true, the completion -- cgit 1.4.1 From 7d301a527e729e2a2fda03069e485bdcc2e12823 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 3 Mar 2014 16:50:14 +0100 Subject: 32441: add completer for file extensions --- ChangeLog | 3 +++ Completion/Base/Completer/_extensions | 33 +++++++++++++++++++++++++++++++++ Doc/Zsh/compsys.yo | 9 +++++++++ 3 files changed, 45 insertions(+) create mode 100644 Completion/Base/Completer/_extensions (limited to 'Doc/Zsh') diff --git a/ChangeLog b/ChangeLog index af2fac8d2..806b14cc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-03-03 Oliver Kiddle + * 32441: Completion/Base/Completer/_extensions, Doc/Zsh/compsys.yo: + add completer for file extensions + * 32450: Src/Zle/zle_hist.c: make get-line set the history number that was saved with the line diff --git a/Completion/Base/Completer/_extensions b/Completion/Base/Completer/_extensions new file mode 100644 index 000000000..8b6c4fd6a --- /dev/null +++ b/Completion/Base/Completer/_extensions @@ -0,0 +1,33 @@ +#autoload + +# This completer completes filename extensions when completing +# after *. or ^*. It can be used anywhere in the completer list +# but if used after _expand, patterns that already match a file +# will be expanded before it is called. + +compset -P '(#b)([~$][^/]#/|)(*/|)(\^|)\*.' || return 1 + +local -aU files +local -a expl suf mfiles + +files=( ${(e)~match[1]}${match[2]}*.* ) || return 1 +eval set -A files '${(MSI:'{1..${#${(O)files//[^.]/}[1]}}':)files%%.[^/]##}' +files=( ${files:#.<->(.*|)} ) + +if zstyle -t ":completion:${curcontext}:extensions" prefix-hidden; then + files=( ${files#.} ) +else + PREFIX=".$PREFIX" + IPREFIX="${IPREFIX%.}" +fi + +zstyle -T ":completion:${curcontext}:extensions" add-space || + suf=( -S '' ) + +_description extensions expl 'file extension' + +# for an exact match, fail so as to give _expand or _match a chance. +compadd -O mfiles "$expl[@]" -a files +[[ $#mfiles -gt 1 || ${mfiles[1]} != $PREFIX ]] && + compadd "$expl[@]" "$suf[@]" -a files && + [[ -z $compstate[exact_string] ]] diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 5a5e61996..f015bbf92 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -3047,6 +3047,15 @@ This function is also a bindable command, see ifzman(the section `Bindable Commands' below)\ ifnzman(noderef(Bindable Commands)). ) +findex(_extensions) +item(tt(_extensions))( +If the cursor follows the string `tt(*.)', filename extensions are +completed. The extensions are taken from files in current directory or a +directory specified at the beginning of the current word. For exact matches, +completion continues to allow other completers such as tt(_expand) to +expand the pattern. The standard tt(add-space) and tt(prefix-hidden) +styles are observed. +) findex(_history) item(tt(_history))( Complete words from the shell's command history. This completer -- cgit 1.4.1