diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/_match_pattern | 31 | ||||
-rw-r--r-- | Completion/Base/_match_test | 15 | ||||
-rw-r--r-- | Completion/Core/_comp_parts | 147 | ||||
-rw-r--r-- | Completion/User/_colors | 24 | ||||
-rw-r--r-- | Completion/User/_pbm | 13 | ||||
-rw-r--r-- | Completion/User/_pspdf | 6 |
6 files changed, 0 insertions, 236 deletions
diff --git a/Completion/Base/_match_pattern b/Completion/Base/_match_pattern deleted file mode 100644 index c5debc0b9..000000000 --- a/Completion/Base/_match_pattern +++ /dev/null @@ -1,31 +0,0 @@ -#autoload - -# This function is called from functions that do matching whenever they -# need to build a pattern that is used to match possible completions. -# It gets the name of the calling function and two names of parameters -# as arguments. The first one is used in the calling function to build -# the pattern used for matching possible completions. The content of this -# parameter on entry to this function is the string taken from the line. -# Here it parameter should be changed to a pattern that matches words as -# the match specs currently in use do. -# In the calling function this pattern may be changed again or used only -# in parts. The second parameter whose name is given as the third argument -# allows to give pattern flags liek `(#l)' that are to be used whenever -# matching is done. -# -# As an example, if you have global match specifications like: -# -# compctl -M 'm:{a-z}={A-Z}' 'm:{a-z}={A-Z} r:|[.-]=* r:|=*' -# -# This function would look like: -# -# eval "${3}='(#l)'" -# [[ MATCHER -eq 2 ]] && eval "$1='${(P)2:gs/./*./:gs/-/*-/}'" -# -# The first line makes sure that matching is done case-insensitive as -# specified by `m:{a-z}={A-Z}'. The second line replaces dots and hyphens -# in the given string by patterns matching any characters before them, -# like the `r:|[.-]=* r:|=*'. To make this work, the function `_match_test' -# would have to be changed to `(( MATCHERS <= 2 ))' -# -# The default implementation of this function is empty. diff --git a/Completion/Base/_match_test b/Completion/Base/_match_test deleted file mode 100644 index e8b6e6424..000000000 --- a/Completion/Base/_match_test +++ /dev/null @@ -1,15 +0,0 @@ -#autoload - -# This function is called at the beginning of functions that do matching in -# shell code. It should test the value of the `MATCHER' special parameter -# and return non-zero if the calling function should try to generate matches -# for the global match specification in use. -# -# This function gets one argument, the name of the function calling it. -# -# If you have a global match specification with more than one set of patterns -# you may want to modify this function to return non-zero for all of your -# match specifications and modify the function `_match_pattern' to build the -# pattern to use in the calling function. - -(( MATCHER == 1 )) diff --git a/Completion/Core/_comp_parts b/Completion/Core/_comp_parts deleted file mode 100644 index 7c24fd19d..000000000 --- a/Completion/Core/_comp_parts +++ /dev/null @@ -1,147 +0,0 @@ -#autoload - -# This function can be used to separately complete parts of strings -# where each part may be one of a set of matches and different parts -# have different sets. -# Arguments are alternatingly arrays and separator strings. Arrays may -# be given by name or literally as words separated by white space in -# parentheses, e.g.: -# -# _comp_parts '(foo bar)' @ hosts -# -# This will make this function complete the strings in the array -# `friends'. If the string on the line contains a `@', the substring -# after it will be completed from the array `hosts'. Of course more -# arrays may be given, each preceded by another separator string. -# -# This function understands the `-J group', `-V group', and -# `-X explanation' options. -# -# This function does part of the matching itself and calls the functions -# `_match_test' and `_match_pattern' for this. - -local str arr sep test testarr tmparr prefix suffixes matchers autosuffix -local matchflags opt group expl - -# Test if we should use this function for the global matcher in use. - -_match_test _comp_parts || return - -# Get the options. - -group=() -expl=() -while getopts "J:V:X:" opt; do - case "$opt" in - [JV]) group=("-$opt" "$OPTARG");; - X) expl=(-X "$OPTARG");; - esac -done -shift OPTIND-1 - -# Get the string from the line. - -str="$PREFIX$SUFFIX" -prefix="" - -# Walk through the arguments to find the longest unambiguous prefix. - -while [[ $# -gt 1 ]]; do - # Get the next array and separator. - arr="$1" - sep="$2" - - if [[ "$arr[1]" == '(' ]]; then - tmparr=( ${=arr[2,-2]} ) - arr=tmparr - fi - # Is the separator on the line? - [[ "$str" != *${sep}* ]] && break - - # Build a pattern matching the possible matches and get all these - # matches in an array. - test="${str%%${sep}*}" - matchflags="" - _match_pattern _comp_parts test matchflags - test="${matchflags}${test}" - testarr=( "${(@M)${(@P)arr}:#${~test}*}" ) - - # If there are no matches we give up. If there is more than one - # match, this is the part we will complete. - (( $#testarr )) || return - [[ $#testarr -gt 1 ]] && break - - # Only one match, add it to the prefix and skip over it in `str', - # continuing with the next array and separator. - prefix="${prefix}${testarr[1]}${sep}" - str="${str#*${sep}}" - shift 2 -done - -# Get the array to work upon. -arr="$1" -if [[ "$arr[1]" == '(' ]]; then - tmparr=( ${=arr[2,-2]} ) - arr=tmparr -fi -if [[ $# -le 1 || "$str" != *${2}* ]]; then - # No more separators, build the matches. - matchflags="" - test="$str" - _match_pattern _comp_parts test matchflags - test="${matchflags}${test}" - testarr=( "${(@M)${(@P)arr}:#${~test}*}" ) -fi - -[[ $#testarr -eq 0 || ${#testarr[1]} -eq 0 ]] && return - -# Now we build the suffixes to give to the completion code. -shift -matchers=() -suffixes=("") -autosuffix=() - -while [[ $# -gt 0 && "$str" == *${1}* ]]; do - # Remove anything up to the the suffix. - str="${str#*${1}}" - - # Again, we get the string from the line up to the next separator - # and build a pattern from it. - if [[ $# -gt 2 ]]; then - test="${str%%${3}*}" - else - test="$str" - fi - matchflags="" - _match_pattern _comp_parts test matchflags - test="${matchflags}${test}" - - # We incrementally add suffixes by appending to them the seperators - # and the strings from the next array that match the pattern we built. - - arr="$2" - if [[ "$arr[1]" == '(' ]]; then - tmparr=( ${=arr[2,-2]} ) - arr=tmparr - fi - suffixes=("${^suffixes[@]}${1}${(@M)^${(@P)arr}:#${~test}*}") - - # We want the completion code to generate the most specific suffix - # for us, so we collect matching specifications that allow partial - # word matching before the separators on the fly. - matchers=("$matchers[@]" "r:|${1}=*") - shift 2 -done - -# If we were given at least one more separator we make the completion -# code offer it by appending it as a autoremovable suffix. -(( $# )) && autosuffix=(-qS "$1") - -# If we have collected matching specifications, we build an array -# from it that can be used as arguments to `compadd'. -[[ $#matchers -gt 0 ]] && matchers=(-M "$matchers") - -# Add the matches for each of the suffixes. -for i in "$suffixes[@]"; do - compadd "$group[@]" "$expl[@]" "$matchers[@]" "$autosuffix[@]" -p "$prefix" -s "$i" - "$testarr[@]" -done diff --git a/Completion/User/_colors b/Completion/User/_colors deleted file mode 100644 index 4e9ee2030..000000000 --- a/Completion/User/_colors +++ /dev/null @@ -1,24 +0,0 @@ -#autoload - -if (( ! $+_color_cache )); then - local file - - # Cache of color names doesn't exist yet, create it. - - if [[ -f /usr/lib/X11/rgb.txt ]]; then - file=/usr/lib/X11/rgb.txt - elif [[ -f /usr/local/lib/X11/rgb.txt ]]; then - file=/usr/local/lib/X11/rgb.txt - fi - - if [[ -n "$file" ]]; then - _color_cache=( "${(@)${(@f)$(< $file)}[2,-1]##* }" ) - else - - # Stupid default value. - - _color_cache=(white black gray red blue green) - fi -fi - -compadd - "$_color_cache[@]" diff --git a/Completion/User/_pbm b/Completion/User/_pbm deleted file mode 100644 index 1e5cb16cb..000000000 --- a/Completion/User/_pbm +++ /dev/null @@ -1,13 +0,0 @@ -#compdef -p p[bgpn]m* - -local pat - -_compskip=1 - -if [[ "$words[1]" = pnm* ]]; then - pat='*.(#i)p[bgp]m' -else - pat="*.(#i)${words[1][1,3]}" -fi - -_path_files -g "$pat" || _files -g '*.(#i)p[bgp]m' diff --git a/Completion/User/_pspdf b/Completion/User/_pspdf deleted file mode 100644 index 014d81ce3..000000000 --- a/Completion/User/_pspdf +++ /dev/null @@ -1,6 +0,0 @@ -#compdef gs gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii ghostview gv gview mgv ggv pstoedit pstotgif - -# ghostscript: -# gs gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii - -_files -g '*.(#i)(ps|eps|pdf)' |