diff options
Diffstat (limited to 'Functions/Completion')
133 files changed, 0 insertions, 2014 deletions
diff --git a/Functions/Completion/.distfiles b/Functions/Completion/.distfiles deleted file mode 100644 index 12621da29..000000000 --- a/Functions/Completion/.distfiles +++ /dev/null @@ -1,11 +0,0 @@ -DISTFILES_SRC=' - .distfiles - __aliases __arrays __autoload __bg_jobs __bindkey __builtin __cd __command - __command_names __compress __condition __configure __dd __default __dirs - __disable __dvi __echotc __enable __fc __files __find __functions __gunzip - __gzip __hash __hosts __jobs __kill __kill_helper __limits __main_complete - __main_key_complete __make __man __mh __most_recent_file __normal __path_files - __pdf __precommand __ps __rcs __rlogin __sched __set __setopt __source __strip - __stty __subscript __tar __tex __trap __uncompress __unhash __unsetopt __vars - __vars_eq __wait __which __x_options __xfig __zle __zmodload init -' diff --git a/Functions/Completion/__aliases b/Functions/Completion/__aliases deleted file mode 100644 index cbf204e51..000000000 --- a/Functions/Completion/__aliases +++ /dev/null @@ -1,2 +0,0 @@ -#array unalias -__aliases=(-a) diff --git a/Functions/Completion/__arrays b/Functions/Completion/__arrays deleted file mode 100644 index 3f6ec8abe..000000000 --- a/Functions/Completion/__arrays +++ /dev/null @@ -1,2 +0,0 @@ -#array shift -__arrays=(-A) diff --git a/Functions/Completion/__autoload b/Functions/Completion/__autoload deleted file mode 100644 index 9c3bb1f4f..000000000 --- a/Functions/Completion/__autoload +++ /dev/null @@ -1,2 +0,0 @@ -#array autoload -__autoload=(-s '${^fpath}/*(N:t)') diff --git a/Functions/Completion/__bg_jobs b/Functions/Completion/__bg_jobs deleted file mode 100644 index 90e3b7ee0..000000000 --- a/Functions/Completion/__bg_jobs +++ /dev/null @@ -1,2 +0,0 @@ -#array bg -__bg_jobs=(-z -P '%') diff --git a/Functions/Completion/__bindkey b/Functions/Completion/__bindkey deleted file mode 100644 index c9005347a..000000000 --- a/Functions/Completion/__bindkey +++ /dev/null @@ -1,7 +0,0 @@ -#function bindkey - -if [[ -mword 1 -*[DAN]* || -mcurrent -1 -*M ]]; then - complist -s '$(bindkey -l)' -else - complist -b -fi diff --git a/Functions/Completion/__builtin b/Functions/Completion/__builtin deleted file mode 100644 index 5b4c777f5..000000000 --- a/Functions/Completion/__builtin +++ /dev/null @@ -1,7 +0,0 @@ -#function builtin - -if [[ -position 2 -1 ]]; then - compsub -else - complist -eB -fi diff --git a/Functions/Completion/__cd b/Functions/Completion/__cd deleted file mode 100644 index ad5e36386..000000000 --- a/Functions/Completion/__cd +++ /dev/null @@ -1,3 +0,0 @@ -#function cd - -__files -W cdpath -g '*(-/)' diff --git a/Functions/Completion/__command b/Functions/Completion/__command deleted file mode 100644 index deaabdb1f..000000000 --- a/Functions/Completion/__command +++ /dev/null @@ -1,7 +0,0 @@ -#function command - -if [[ -position 2 -1 ]]; then - compsub -else - complist -em -fi diff --git a/Functions/Completion/__command_names b/Functions/Completion/__command_names deleted file mode 100644 index 7a28fa527..000000000 --- a/Functions/Completion/__command_names +++ /dev/null @@ -1,2 +0,0 @@ -#array --command-- -__command_names=(-c) diff --git a/Functions/Completion/__compress b/Functions/Completion/__compress deleted file mode 100644 index d4e71f531..000000000 --- a/Functions/Completion/__compress +++ /dev/null @@ -1,3 +0,0 @@ -#function compress - -__files -g '*~*.Z' diff --git a/Functions/Completion/__condition b/Functions/Completion/__condition deleted file mode 100644 index 8ceb969b8..000000000 --- a/Functions/Completion/__condition +++ /dev/null @@ -1,10 +0,0 @@ -#function --condition-- - -if [[ -current -1 -o ]]; then - complist -o -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -elif [[ -current -1 -nt || -current -1 -ot || -current -1 -ef ]]; then - files -else - files - complist -v -fi diff --git a/Functions/Completion/__configure b/Functions/Completion/__configure deleted file mode 100644 index a4d00e0f2..000000000 --- a/Functions/Completion/__configure +++ /dev/null @@ -1,11 +0,0 @@ -#function configure -if [[ $PREFIX = *=* ]]; then - # Complete filenames after e.g. --prefix= - IPREFIX=${PREFIX%%=*}= - PREFIX=${PREFIX#*=} - complist -f -else - # Generate a list of options from configure --help - complist -s '$($COMMAND --help | - sed -n -e '\''s/^ *\(--[-a-z0-9]*\)[ =,].*$/\1/p'\'')' -fi diff --git a/Functions/Completion/__dd b/Functions/Completion/__dd deleted file mode 100644 index c0e04de75..000000000 --- a/Functions/Completion/__dd +++ /dev/null @@ -1,13 +0,0 @@ -#function dd - -if [[ -iprefix conv= ]]; then - # If there's a comma present, ignore up to the last one. The - # test alone will have that effect. - [[ -string , ]] - complist -S, -q \ - -k '(ascii ebcdic ibm block unblock lcase ucase swab noerror sync)' -elif [[ -iprefix 'if=' || -iprefix 'of=' ]]; then - __files -else - complist -S '=' -k '(if of ibs obs bs cbs skip files seek count conv)' -fi diff --git a/Functions/Completion/__default b/Functions/Completion/__default deleted file mode 100644 index cabe14a36..000000000 --- a/Functions/Completion/__default +++ /dev/null @@ -1,13 +0,0 @@ -#function --default-- - -# We first try the `compctl's. This is without first (-T) and default (-D) -# completion. If you want them add `-T' and/or `-D' to this command. -# If there is a `compctl' for the command we are working on, we return -# immediatly. If you want to use new style completion anyway, remove the -# `|| return'. Also, you may want to use new style completion if the -# `compctl' didn't produce any matches. In that case remove the `|| return' -# and at the line `[[ -nmatches 0 ]] || return' after `compcall'. - -compcall || return - -__files diff --git a/Functions/Completion/__dirs b/Functions/Completion/__dirs deleted file mode 100644 index a838168bc..000000000 --- a/Functions/Completion/__dirs +++ /dev/null @@ -1,3 +0,0 @@ -#function rmdir df du dircmp - -__files -/ '*(-/)' diff --git a/Functions/Completion/__disable b/Functions/Completion/__disable deleted file mode 100644 index c56ffb7f7..000000000 --- a/Functions/Completion/__disable +++ /dev/null @@ -1,6 +0,0 @@ -#function disable - -[[ -mcurrent -1 -*a* ]] && complist -ea -[[ -mcurrent -1 -*f* ]] && complist -eF -[[ -mcurrent -1 -*r* ]] && complist -ew -[[ ! -mcurrent -1 -* ]] && complist -eB diff --git a/Functions/Completion/__dvi b/Functions/Completion/__dvi deleted file mode 100644 index 873d5812a..000000000 --- a/Functions/Completion/__dvi +++ /dev/null @@ -1,3 +0,0 @@ -#function xdvi dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype - -__files -g '*.(dvi|DVI)' diff --git a/Functions/Completion/__echotc b/Functions/Completion/__echotc deleted file mode 100644 index d9b7029c1..000000000 --- a/Functions/Completion/__echotc +++ /dev/null @@ -1,2 +0,0 @@ -#array echotc -__echotc=(-k '(al dc dl do le up al bl cd ce cl cr dc dl do ho is le ma nd nl se so up)') diff --git a/Functions/Completion/__enable b/Functions/Completion/__enable deleted file mode 100644 index b315611df..000000000 --- a/Functions/Completion/__enable +++ /dev/null @@ -1,6 +0,0 @@ -#function enable - -[[ -mcurrent -1 -*a* ]] && complist -da -[[ -mcurrent -1 -*f* ]] && complist -dF -[[ -mcurrent -1 -*r* ]] && complist -dw -[[ ! -mcurrent -1 -* ]] && complist -dB diff --git a/Functions/Completion/__fc b/Functions/Completion/__fc deleted file mode 100644 index 9185312b0..000000000 --- a/Functions/Completion/__fc +++ /dev/null @@ -1,7 +0,0 @@ -#function fc - -if [[ -mcurrent -1 -*e ]]; then - complist -c -elif [[ -mcurrent -1 -[ARWI]## ]]; then - __files -fi diff --git a/Functions/Completion/__files b/Functions/Completion/__files deleted file mode 100644 index dfade8c7f..000000000 --- a/Functions/Completion/__files +++ /dev/null @@ -1,10 +0,0 @@ -#helper - -# Utility function for completing files of a given type or any file. -# In many cases you will want to call this one instead of __path_files(). - -local nm=$NMATCHES - -__path_files "$@" - -[[ $# -ne 0 && -nmatches nm ]] && __path_files diff --git a/Functions/Completion/__find b/Functions/Completion/__find deleted file mode 100644 index b16bb09c7..000000000 --- a/Functions/Completion/__find +++ /dev/null @@ -1,24 +0,0 @@ -#function find - -compsave - -if [[ -mbetween -(ok|exec) \\\; ]]; then - compsub -elif [[ -iprefix - ]]; then - complist -s 'daystart {max,min,}depth follow noleaf version xdev \ -{a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links \ -{i,}{l,}name {no,}{user,group} path perm regex size true uid used \ -exec {f,}print{f,0,} ok prune ls' - compreset -elif [[ -position 1 ]]; then - complist -g '. ..' - __files -g '(-/)' -elif [[ -mcurrent -1 -((a|c|)newer|fprint(|0|f)) ]]; then - __files -elif [[ -current -1 -fstype ]]; then - complist -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' -elif [[ -current -1 -group ]]; then - complist -k groups -elif [[ -current -1 -user ]]; then - complist -u -fi diff --git a/Functions/Completion/__functions b/Functions/Completion/__functions deleted file mode 100644 index 4fd24e379..000000000 --- a/Functions/Completion/__functions +++ /dev/null @@ -1,2 +0,0 @@ -#array unfunction -__functions=(-F) diff --git a/Functions/Completion/__gunzip b/Functions/Completion/__gunzip deleted file mode 100644 index f14803c62..000000000 --- a/Functions/Completion/__gunzip +++ /dev/null @@ -1,3 +0,0 @@ -#function gunzip zcat - -__files -g '*.[gG][z]' diff --git a/Functions/Completion/__gzip b/Functions/Completion/__gzip deleted file mode 100644 index ce4e0787a..000000000 --- a/Functions/Completion/__gzip +++ /dev/null @@ -1,3 +0,0 @@ -#function gzip - -__files -g '*~*.[gG][zZ]' diff --git a/Functions/Completion/__hash b/Functions/Completion/__hash deleted file mode 100644 index bd43eb967..000000000 --- a/Functions/Completion/__hash +++ /dev/null @@ -1,13 +0,0 @@ -#function hash - -if [[ -mword 1 -*d* ]]; then - if [[ -string 1 '=' ]]; then - pfiles -g '*(-/)' - else - complist -n -q -S '=' - fi -elif [[ -string 1 '=' ]]; then - files -g '*(*)' '*(-/)' -else - complist -m -q -S '=' -fi diff --git a/Functions/Completion/__hosts b/Functions/Completion/__hosts deleted file mode 100644 index a91251581..000000000 --- a/Functions/Completion/__hosts +++ /dev/null @@ -1,2 +0,0 @@ -#array ftp ncftp ping rwho rup xping traceroute nslookup -__hosts=(-k hosts) diff --git a/Functions/Completion/__jobs b/Functions/Completion/__jobs deleted file mode 100644 index d3e0d7776..000000000 --- a/Functions/Completion/__jobs +++ /dev/null @@ -1,2 +0,0 @@ -#array fg jobs -__jobs=(-j -P '%') diff --git a/Functions/Completion/__kill b/Functions/Completion/__kill deleted file mode 100644 index 09ba248dc..000000000 --- a/Functions/Completion/__kill +++ /dev/null @@ -1,8 +0,0 @@ -#function kill - -if [[ -iprefix '-' ]]; then - complist -k "($signals[1,-3])" -else - complist -P '%' -j - complist -y __kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' -fi diff --git a/Functions/Completion/__kill_helper b/Functions/Completion/__kill_helper deleted file mode 100644 index e1d286938..000000000 --- a/Functions/Completion/__kill_helper +++ /dev/null @@ -1,3 +0,0 @@ -#helper - -reply=( "$(ps 2>/dev/null)" ) diff --git a/Functions/Completion/__limits b/Functions/Completion/__limits deleted file mode 100644 index e3f97155d..000000000 --- a/Functions/Completion/__limits +++ /dev/null @@ -1,2 +0,0 @@ -#array limit unlimit -__limits=(-k "(${(j: :)${(f)$(limit)}%% *})") diff --git a/Functions/Completion/__main_complete b/Functions/Completion/__main_complete deleted file mode 100644 index 48f2338de..000000000 --- a/Functions/Completion/__main_complete +++ /dev/null @@ -1,48 +0,0 @@ -#helper - -# The main loop of the completion code. This is what is called when -# completion is attempted from the command line. -# The completion code gives us the special variables and the arguments -# from the command line are given as positional parameters. - -local comp name - -setopt localoptions nullglob rcexpandparam globdots -unsetopt markdirs globsubst shwordsplit nounset - -# An entry for `--first--' is the replacement for `compctl -T' -# The `|| return 1' is used throughout: if a function producing matches -# returns non-zero this is interpreted as `do not try to produce more matches' -# (this is the replacement for `compctl -t'). - -comp="$comps[--first--]" -[[ -z "$comp" ]] || callcomplete comps --first-- "$@" || return 1 - -# For arguments we use the `__normal' function called via the convenience -# alias `compsub'. - -if [[ $CONTEXT == argument || $CONTEXT == command ]]; then - compsub -else - # Let's see if we have a special completion definition for the other - # possible contexts. - - comp='' - - case $CONTEXT in - redirect) name=--redirect--;; - math) name=--math--;; - subscript) name=--subscript--;; - value) name=--value--;; - condition) name=--condition--;; - esac - - # If not, we use default completion, if any. - - comp="$comps[$name]" - if [[ -z "$comp" ]]; then - name=--default-- - comp="$comps[--default--]" - fi - [[ -z "$comp" ]] || callcomplete comps "$name" "$@" || return 1 -fi diff --git a/Functions/Completion/__main_key_complete b/Functions/Completion/__main_key_complete deleted file mode 100644 index 35fa1a0a3..000000000 --- a/Functions/Completion/__main_key_complete +++ /dev/null @@ -1,6 +0,0 @@ -#helper - -# The widget name looks like `__complete_key_<num>' where <num> can be -# used as an index into the `keycomps' array to get at the definition. - -callcomplete keycomps "$WIDGET" "$@" diff --git a/Functions/Completion/__make b/Functions/Completion/__make deleted file mode 100644 index 4a2c5a7c8..000000000 --- a/Functions/Completion/__make +++ /dev/null @@ -1,3 +0,0 @@ -#function make gmake pmake - -complist -s "\$(awk '/^[a-zA-Z0-9][^/ ]+:/ {print \$1}' FS=: [mM]akefile)" diff --git a/Functions/Completion/__man b/Functions/Completion/__man deleted file mode 100644 index a0f00f58b..000000000 --- a/Functions/Completion/__man +++ /dev/null @@ -1,11 +0,0 @@ -#function man -setopt localoptions rcexpandparam - -local rep -if [[ $2 = (<->*|ln) ]]; then - rep=( $manpath/(man|cat)$2/$PREFIX*$SUFFIX.<->*(N:t:r) ) -else - rep=( $manpath/(man|cat)*/$PREFIX*$SUFFIX.<->*(N:t:r) ) -fi - -(( $#rep )) && compadd -m $rep diff --git a/Functions/Completion/__mh b/Functions/Completion/__mh deleted file mode 100644 index 2e4738e17..000000000 --- a/Functions/Completion/__mh +++ /dev/null @@ -1,70 +0,0 @@ -#function folder comp inc mark refile repl scan show next prev rmm pick whom mhn mhpath mhpatch - -# Completion for all possible MH commands. -# Alter the following two to your own mh directory and the directory -# where standard mh library files live. (It works anyway, but this -# will save a little time.) -local mymhdir=~/Mail -local mhlib=/usr/lib/mh - -# To be on the safe side, check this exists and if not, get it anyway. -[[ -d $mymhdir ]] || mymhdir=$(mhpath +) - -if [[ -iprefix - ]]; then - # get list of options, which MH commands can generate themselves - # awk is just too icky to use for this, sorry. send me one if - # you come up with it. - compadd -m $($COMMAND -help | perl -ne 'if (/^\s*-\(?(\S+)/) { - $n = $1; - $n =~ s/\)//g; - print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n"; - }') - return -elif [[ -iprefix '+' || -iprefix '@' || -current -1 -draftfolder ]]; then - # Complete folder names. - local mhpath - if [[ $IPREFIX != '@' ]]; then - [[ $IPREFIX = '+' ]] || IPREFIX=+ - mhpath=$mymhdir - else - mhpath=$(mhpath) - fi - - # painless, or what? - complist -W mhpath -/ -elif [[ -mcurrent -1 -(editor|(whatnow|rmm|show|more)proc) ]]; then - complist -c -elif [[ -current -1 -file ]]; then - complist -f -elif [[ -mcurrent -1 -(form|audit|filter) ]]; then - # Need some MH template file, which may be in our own MH directory - # or with the standard library. - local mhfpath - # This is the only place we need mhlib, so leave the test till here. - [[ -d $mhlib ]] || { mhlib=$(mhparam mhlproc); mhlib=$mhlib:h; } - mhfpath=($mymhdir $mhlib) - - complist -W mhfpath -g '*(.)' -elif [[ -mcurrent -1 -(no|)cc ]]; then - compadd -m all to cc me -elif [[ -mcurrent -1 -[rw]cache ]]; then - compadd -m public private never ask -else - # Generate sequences. - local foldnam folddir f - for f in $argv; do - [[ $f = [@+]* ]] && foldnam=$f - done - if [[ $foldnam = '+'* ]]; then - folddir=$mymhdir/${foldnam#+} - elif [[ $foldnam = '@'* ]]; then - folddir=$(mhpath)/${foldnam#@} - else - folddir=$(mhpath) - # leaving foldnam empty works here - fi - - complist -s '$(mark $foldnam | awk -F: '\''{ print $1 }'\'')' - compadd -m reply next cur prev first last all unseen - complist -W folddir -g '<->' -fi diff --git a/Functions/Completion/__most_recent_file b/Functions/Completion/__most_recent_file deleted file mode 100644 index cf1f83282..000000000 --- a/Functions/Completion/__most_recent_file +++ /dev/null @@ -1,2 +0,0 @@ -#key-array expand-or-complete \C-xm -__most_recent_file=(-g '*(om[1])') diff --git a/Functions/Completion/__normal b/Functions/Completion/__normal deleted file mode 100644 index 7750563d1..000000000 --- a/Functions/Completion/__normal +++ /dev/null @@ -1,54 +0,0 @@ -#helper - -local comp cmd1 cmd2 pat val name - -# Completing in command position? If not we set up `cmd1' and `cmd2' as -# two strings we have search in the completion definition arrays (e.g. -# a path and the last path name component). - -if [[ $CONTEXT == command ]]; then - comp="$comps[--command--]" - [[ -z "$comp" ]] || callcomplete comps --command-- "$@" || return 1 - return 0 -elif [[ "$COMMAND[1]" == '=' ]]; then - eval cmd1\=$COMMAND - cmd2="$COMMAND[2,-1]" -elif [[ "$COMMAND" == */* ]]; then - cmd1="$COMMAND" - cmd2="${COMMAND:t}" -else - cmd1="$COMMAND" - eval cmd2=$(whence -p $COMMAND) -fi - -# See if there are any matching pattern completions. - -if (( $#patcomps )); then - for i in "$patcomps[@]"; do - pat="${i% *}" - val="${i#* }" - if [[ "$cmd1" == $~pat || "$cmd2" == $~pat ]]; then - callcomplete patcomps "$pat" "$@" || return 1 - fi - done -fi - -# Now look up the two names in the normal completion array. - -name="$cmd1" -comp="$comps[$cmd1]" - -if [[ -z "$comp" ]]; then - name="$cmd2" - comp="$comps[$cmd2]" -fi - -# And generate the matches, probably using default completion. - -if [[ -z "$comp" ]]; then - name=--default-- - comp="$comps[--default--]" -fi -[[ -z "$comp" ]] || callcomplete comps "$name" "$@" || return 1 - -return 0 diff --git a/Functions/Completion/__path_files b/Functions/Completion/__path_files deleted file mode 100644 index f9e7c631a..000000000 --- a/Functions/Completion/__path_files +++ /dev/null @@ -1,272 +0,0 @@ -#helper - -# Utility function for in-path completion. -# First argument should be an complist-option (e.g. -f, -/, -g). The other -# arguments should be glob patterns, one per argument. -# -# E.g.: __path_files -g '*.tex' '*.texi' -# -# This is intended as a replacement for `complist -f', `complist -/', and -# `complist -g ...' (but don't use it with other options). -# -# You may also give the `-W <spec>' option as with `compctl' and `complist', -# but only as the first argument. -# -# This function also accepts an optional `-F <string>' option as its first -# argument or just after the `-W <spec>'. This can be used to define file -# name extension (a la `fignore'). Files with such an extension will not -# be considered possible completions. -# -# This function behaves as if you have a matcher definition like: -# compctl -M 'r:|[-.,_/]=* r:|=* m:{a-z}={A-Z} m:-=_ m:.=,' \ -# 'm:{a-z}={A-Z} l:|=* r:|=*' -# so you may want to modify this. - -local nm prepaths str linepath realpath donepath patstr prepath testpath rest -local tmp1 collect tmp2 suffixes i ignore - -setopt localoptions nullglob rcexpandparam globdots extendedglob -unsetopt markdirs globsubst shwordsplit nounset - -# Get the optional `-W' option and its argument. -if [[ "$1" = -W ]]; then - tmp1="$2" - if [[ "$tmp1[1]" = '(' ]]; then - prepaths=( $tmp1[2,-2]/ ) - else - prepaths=( ${(P)${tmp1}} ) - [[ $#prepaths -eq 0 ]] && prepaths=( $tmp1/ ) - fi - [[ $#prepaths -eq 0 ]] && prepaths=( '' ) - shift 2 -else - prepaths=( '' ) -fi - -# Get the optional `-F' option and its argument. -if [[ "$1" = -F ]]; then - ignore=(-F "$2") - shift 2 -else - ignore='' -fi - -# str holds the whole string from the command line with a `*' between -# the prefix and the suffix. - -str="${PREFIX:q}*${SUFFIX:q}" - -# We will first try normal completion called with `complist', but only if we -# weren't given a `-F' option. - -if [[ -z "$ignore" ]]; then - # First build an array containing the `-W' option, if there is any and we - # want to use it. We don't want to use it if the string from the command line - # is a absolute path or relative to the current directory. - - if [[ -z "$tmp1[1]" || "$str[1]" = [~/] || "$str" = (.|..)/* ]]; then - tmp1=() - else - tmp1=(-W "( $ppres )") - fi - - # Now call complist. - - nm=$NMATCHES - if [[ $# -eq 0 ]]; then - complist "$tmp1[@]" -f - elif [[ "$1" = -g ]]; then - complist "$tmp1[@]" -g "$argv[2,-1]" - shift - else - complist "$tmp1[@]" $1 - shift - fi - - # If this generated any matches, we don't wnat to do in-path completion. - - [[ -nmatches nm ]] || return - - # No `-F' option, so we want to use `fignore'. - - ignore=(-F fignore) -fi - -# If we weren't given any file patterns as arguments, we trick ourselves -# into believing that we were given the pattern `*'. This is just to simplify -# the following code. - -[[ -z "$1" ]] && 1='*' - -# Now let's have a closer look at the string to complete. - -if [[ "$str[1]" = \~ ]]; then - # It begins with `~', so remember anything before the first slash to be able - # to report it to the completion code. Also get an expanded version of it - # (in `realpath'), so that we can generate the matches. Then remove that - # prefix from the string to complete, set `donepath' to build the correct - # paths and make sure that the loop below is run only once with an empty - # prefix path by setting `prepaths'. - - linepath="${str%%/*}/" - eval realpath\=path - str="${str#*/}" - donepath='' - prepaths=( '' ) -else - # If the string does not start with a `~' we don't remove a prefix from the - # string. - - liniepath='' - realpath='' - - if [[ "$str[1]" = / ]]; then - # If it is a absolut path name, we remove the first slash and put it in - # `donepath' meaning that we treat it as the path that was already handled. - # Also, we don't use the paths from `-W'. - - str="$str[2,-1]" - donepath='/' - prepaths=( '' ) - else - # The common case, we just use the string as it is, unless it begins with - # `./' or `../' in which case we don't use the paths from `-W'. - - [[ "$str" = (.|..)/* ]] && prepaths=( '' ) - donepath='' - fi -fi - -# First we skip over all pathname components in `str' which really exist in -# the file-system, so that `/usr/lib/l<TAB>' doesn't offer you `lib' and -# `lib5'. Pathname components skipped this way are taken from `str' and added -# to `donepath'. - -while [[ "$str" = */* ]] do - [[ -e "$realpath$donepath${str%%/*}" ]] || break - donepath="$donepath${str%%/*}/" - str="${str#*/}" -done - -# Now build the glob pattern. As noted above, this function behaves as if -# a global matcher with two matching specifications are given. - -if [[ -matcher 1 ]]; then - patstr="$str:gs/,/*,/:gs/_/*_/:gs./.*/.:gs/-/*[-_]/:gs/./*[.,]/:gs-*[.,]*[.,]*/-../-:gs.**.*." -else - patstr="${str%/*}/*${str##*/}*" - patstr="$patstr:gs./.*/.:gs.**.*." -fi - -# Finally, generate the matches. First we loop over all the paths from `-W'. -# Note that in this loop `str' is used as a modifyable version of `patstr' -# and `testpath' is a modifyable version of `donepath'. - -for prepath in "$prepaths[@]"; do - str="$patstr" - testpath="$donepath" - - # The second loop tests the components of the path in `str' to get the - # possible matches. - - while [[ "$str" = */* ]] do - # `rest' is the pathname after the first slash that is left. In `tmp1' - # we get the globbing matches for the pathname component currently - # handled. - - rest="${str#*/}" - tmp1="${prepath}${realpath}${testpath}(#l)${str%%/*}(-/)" - tmp1=( $~tmp1 ) - - if [[ $#tmp1 -eq 0 ]]; then - # If this didn't produce any matches, we don't need to test this path - # any further, so continue with the next `-W' path, if any. - - continue 2 - elif [[ $#tmp1 -gt 1 ]]; then - # If it produced more than one match, we want to remove those which - # don't have possible following pathname components matching the - # rest of the string we are completing. (The case with only one - # match is handled below.) - # In `collect' we will collect those of the produced pathnames that - # have a matching possible path-suffix. In `suffixes' we build an - # array containing strings build from the rest of the string to - # complete and the glob patterns we were given as arguments. - - collect=() - suffixes=( $rest$@ ) - suffixes=( "${(@)suffixes:gs.**.*.}" ) - - # In the loop the prefixes from the `tmp1' array produced above and - # the suffixes we just built are used to produce possible matches - # via globbing. - - for i in $tmp1; do - tmp2=( $~i/(#l)$~suffixes ) - [[ $#tmp2 -ne 0 ]] && collect=( $collect $i ) - done - - # If this test showed that none of the matches from the glob in `tmp1' - # has a possible sub-path matching what's on the line, we give up and - # continue with the next `-W' path. - - if [[ $#collect -eq 0 ]]; then - continue 2 - elif [[ $#collect -ne 1 ]]; then - # If we have more than one possible match, this means that the - # pathname component currently handled is ambiguous, so we give - # it to the completion code. - # First we build the full path prefix in `tmp1'. - - tmp1="$prepath$realpath$testpath" - - # Now produce all matching pathnames in `collect'. - - collect=( $~collect/(#l)$~suffixes ) - - # And then remove the common path prefix from all these matches. - - collect=( ${collect#$tmp1} ) - - # Finally, we add all these matches with the common (unexpanded) - # pathprefix (the `-p' option), the path-prefix (the `-W' option) - # to allow the completion code to test file type, and the path- - # suffix (the `-s' option). We also tell the completion code that - # these are file names and that `fignore' should be used as usual - # (the `-f' and `-F' options). - - for i in $collect; do - compadd -p "$linepath$testpath" -W "$tmp1" -s "/${i#*/}" -f "$ignore[@]" -- "${i%%/*}" - done - - # We have just finished handling all the matches from above, so we - # can continue with the next `-W' path. - - continue 2 - fi - # We reach this point if only one of the path prefixes in `tmp1' - # has a existing path-suffix matching the string from the line. - # In this case we accept this match and continue with the next - # path-name component. - - tmp1=( "$collect[1]" ) - fi - # This is also reached if the first globbing produced only one match - # in this case we just continue with the next pathname component, too. - - tmp1="$tmp1[1]" - testpath="$testpath${tmp1##*/}/" - str="$rest" - done - - # We are here if all pathname components except the last one (which is still - # not tested) are unambiguous. So we add matches with the full path prefix, - # no path suffix, the `-W' we are currently handling, all the matches we - # can produce in this directory, if any. - - tmp1="$prepath$realpath$testpath" - suffixes=( $str$@ ) - suffixes=( "${(@)suffixes:gs.**.*.}" ) - tmp2=( $~tmp1(#l)$~suffixes ) - compadd -p "$linepath$testpath" -W "$prepath$realpath$testpath" -f "$ignore[@]" -- ${tmp2#$tmp1} -done diff --git a/Functions/Completion/__pdf b/Functions/Completion/__pdf deleted file mode 100644 index 97f656f40..000000000 --- a/Functions/Completion/__pdf +++ /dev/null @@ -1,3 +0,0 @@ -function acroread - -__files -g '*.(pdf|PDF)' diff --git a/Functions/Completion/__precommand b/Functions/Completion/__precommand deleted file mode 100644 index a07cae96a..000000000 --- a/Functions/Completion/__precommand +++ /dev/null @@ -1,15 +0,0 @@ -#function - nohup nice eval time rusage noglob nocorrect exec - -# We just change the special completion parameters, to make the first -# argument be treated as the command name and removing it from the -# positional parameters. - -COMMAND="$1" -shift -(( CURRENT-- )) -if [[ CURRENT -eq 0 ]]; then - CONTEXT=command -else - CONTEXT=argument -fi -compsub diff --git a/Functions/Completion/__ps b/Functions/Completion/__ps deleted file mode 100644 index fa7395113..000000000 --- a/Functions/Completion/__ps +++ /dev/null @@ -1,3 +0,0 @@ -#function gs ghostview gview psnup psselect pswrap pstops pstruct lpr - -__files -g '*([pP][sS]|eps)' diff --git a/Functions/Completion/__rcs b/Functions/Completion/__rcs deleted file mode 100644 index 8d55cc470..000000000 --- a/Functions/Completion/__rcs +++ /dev/null @@ -1,9 +0,0 @@ -#function co ci rcs - -[[ $COMMAND = ci || $COMMAND = rcs ]] && __files - -if [[ $NMATCHES -eq 0 && -d RCS && $COMMAND != ci ]]; then - local rep - rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//)) - (( $#rep )) && compadd -m $rep -fi diff --git a/Functions/Completion/__rlogin b/Functions/Completion/__rlogin deleted file mode 100644 index 69fdebe13..000000000 --- a/Functions/Completion/__rlogin +++ /dev/null @@ -1,9 +0,0 @@ -#function rlogin rsh ssh - -if [[ -position 1 ]]; then - complist -k hosts -elif [[ -position 2 ]]; then - complist -k '(-l)' -else - complist -u -fi diff --git a/Functions/Completion/__sched b/Functions/Completion/__sched deleted file mode 100644 index dcd7385e1..000000000 --- a/Functions/Completion/__sched +++ /dev/null @@ -1,3 +0,0 @@ -#function sched - -[[ -position 2 -1 ]] && compsub diff --git a/Functions/Completion/__set b/Functions/Completion/__set deleted file mode 100644 index e9db6c43a..000000000 --- a/Functions/Completion/__set +++ /dev/null @@ -1,7 +0,0 @@ -#function set - -if [[ -mcurrent -1 [-+]o ]]; then - complist -o -elif [[ -current -1 -A ]]; then - complist -A -fi diff --git a/Functions/Completion/__setopt b/Functions/Completion/__setopt deleted file mode 100644 index 8a97befc7..000000000 --- a/Functions/Completion/__setopt +++ /dev/null @@ -1,7 +0,0 @@ -#function setopt - -local nm=$NMATCHES - -complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \ - -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)' -[[ -nmatches nm ]] && complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o diff --git a/Functions/Completion/__source b/Functions/Completion/__source deleted file mode 100644 index 3478c9f38..000000000 --- a/Functions/Completion/__source +++ /dev/null @@ -1,7 +0,0 @@ -#function source - -if [[ -position 2 -1 ]]; then - compsub -else - __files -fi diff --git a/Functions/Completion/__strip b/Functions/Completion/__strip deleted file mode 100644 index 9abd38b63..000000000 --- a/Functions/Completion/__strip +++ /dev/null @@ -1,2 +0,0 @@ -#function strip -__files -g '*(*)' diff --git a/Functions/Completion/__stty b/Functions/Completion/__stty deleted file mode 100644 index ebf0de68f..000000000 --- a/Functions/Completion/__stty +++ /dev/null @@ -1,16 +0,0 @@ -#function stty - -if [[ -mcurrent -1 \ - (*erase|discard|status|dsusp|intr|kill|lnext|quit|reprint|start|s*p) ]] -then - compadd -m -Q '^-' '^h' '^?' '^c' '^u' -else - [[ -string '-' || -string '+' ]] - compadd -m rows columns intr quit erase kill eof eol \ - eol2 start stop susp dsusp reprint discard werase lnext \ - parenb parodd cs8 cstopb hupcl cread clocal parext \ - ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl iuclc \ - ixon ixany ixoff imaxbel isig icanon xcase echo echoe echok \ - echonl noflsh tostop echoctl echoprt echoke flusho pending iexten \ - opost olcuc onlcr ocrnl onocr onlret ofill ofdel -fi diff --git a/Functions/Completion/__subscript b/Functions/Completion/__subscript deleted file mode 100644 index a10b1202b..000000000 --- a/Functions/Completion/__subscript +++ /dev/null @@ -1,4 +0,0 @@ -#function --subscript-- - -compalso --math-- "$@" -[[ ${(Pt)${COMMAND}} = assoc* ]] && complist -k "( ${(kP)${COMMAND}} )" diff --git a/Functions/Completion/__tar b/Functions/Completion/__tar deleted file mode 100644 index 4f8b51a00..000000000 --- a/Functions/Completion/__tar +++ /dev/null @@ -1,14 +0,0 @@ -#function tar - -local nm=$NMATCHES tf="$2" -compsave - -if [[ ( -mword 1 *t*f* || -mword 1 *x*f* ) && -position 3 100000 ]]; then - complist -k "( $(tar tf $tf) )" - compreset -elif [[ -mword 1 *c*f* && -position 3 100000 ]]; then - __files - compreset -elif [[ -mcurrent -1 *f* && -position 2 ]]; then - __files -g '*.(tar|TAR)' -fi diff --git a/Functions/Completion/__tex b/Functions/Completion/__tex deleted file mode 100644 index 7331bb794..000000000 --- a/Functions/Completion/__tex +++ /dev/null @@ -1,3 +0,0 @@ -#function tex latex slitex - -__files -g '*.(tex|TEX|texinfo|texi)' diff --git a/Functions/Completion/__trap b/Functions/Completion/__trap deleted file mode 100644 index 0171bdc2b..000000000 --- a/Functions/Completion/__trap +++ /dev/null @@ -1,7 +0,0 @@ -#function trap - -if [[ -position 1 ]]; then - complist -c -else - complist -k signals -fi diff --git a/Functions/Completion/__uncompress b/Functions/Completion/__uncompress deleted file mode 100644 index 91343521e..000000000 --- a/Functions/Completion/__uncompress +++ /dev/null @@ -1,3 +0,0 @@ -#function uncompress zmore - -__files -g '*.Z' diff --git a/Functions/Completion/__unhash b/Functions/Completion/__unhash deleted file mode 100644 index 73196ca1b..000000000 --- a/Functions/Completion/__unhash +++ /dev/null @@ -1,6 +0,0 @@ -#function unhash - -[[ -mword 1 -*d* ]] && complist -n -[[ -mword 1 -*a* ]] && complist -a -[[ -mword 1 -*f* ]] && complist -F -[[ ! -mword 1 -* ]] && complist -m diff --git a/Functions/Completion/__unsetopt b/Functions/Completion/__unsetopt deleted file mode 100644 index c9a074d9b..000000000 --- a/Functions/Completion/__unsetopt +++ /dev/null @@ -1,7 +0,0 @@ -#function unsetopt - -local nm=$NMATCHES - -complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \ - -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)' -[[ -nmatches nm ]] && complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o diff --git a/Functions/Completion/__vars b/Functions/Completion/__vars deleted file mode 100644 index 649e347fa..000000000 --- a/Functions/Completion/__vars +++ /dev/null @@ -1,2 +0,0 @@ -#array --math-- getopts read unset vared -__vars=(-v) diff --git a/Functions/Completion/__vars_eq b/Functions/Completion/__vars_eq deleted file mode 100644 index e0b5d9ae5..000000000 --- a/Functions/Completion/__vars_eq +++ /dev/null @@ -1,2 +0,0 @@ -#array declare export integer local readonly typeset -__varseq=(-v -q -S '=') diff --git a/Functions/Completion/__wait b/Functions/Completion/__wait deleted file mode 100644 index 1c04108f6..000000000 --- a/Functions/Completion/__wait +++ /dev/null @@ -1,4 +0,0 @@ -#function wait - -complist -P '%' -j -complist -y __kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' diff --git a/Functions/Completion/__which b/Functions/Completion/__which deleted file mode 100644 index 32b95b9c5..000000000 --- a/Functions/Completion/__which +++ /dev/null @@ -1,2 +0,0 @@ -#array which whence where type -__which=(-caF) diff --git a/Functions/Completion/__x_options b/Functions/Completion/__x_options deleted file mode 100644 index d5f85ea36..000000000 --- a/Functions/Completion/__x_options +++ /dev/null @@ -1,5 +0,0 @@ -#pattern-function '*/X11/*' - -# A simple pattern completion, just as an example. - -complist -J options -k '(-display -name -xrm)' diff --git a/Functions/Completion/__xfig b/Functions/Completion/__xfig deleted file mode 100644 index 7f17c2e42..000000000 --- a/Functions/Completion/__xfig +++ /dev/null @@ -1,3 +0,0 @@ -#function xfig - -__files -g '*.fig' diff --git a/Functions/Completion/__zle b/Functions/Completion/__zle deleted file mode 100644 index f677374c8..000000000 --- a/Functions/Completion/__zle +++ /dev/null @@ -1,7 +0,0 @@ -#function zle - -if [[ -word 1 -N && -position 3 ]]; then - complist -F -else - complist -b -fi diff --git a/Functions/Completion/__zmodload b/Functions/Completion/__zmodload deleted file mode 100644 index 78c7393a3..000000000 --- a/Functions/Completion/__zmodload +++ /dev/null @@ -1,9 +0,0 @@ -#function zmodload - -if [[ -mword 1 -*(a*u|u*a)* || -mword 1 -*a* && -position 3 -1 ]]; then - complist -B -elif [[ -mword 1 -*u* ]]; then - complist -s '$(zmodload)' -else - complist -s '${^module_path}/*(N:t:r)' -fi diff --git a/Functions/Completion/_aliases b/Functions/Completion/_aliases deleted file mode 100644 index 1038a726e..000000000 --- a/Functions/Completion/_aliases +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp unalias - -complist -a diff --git a/Functions/Completion/_arrays b/Functions/Completion/_arrays deleted file mode 100644 index cbeac7118..000000000 --- a/Functions/Completion/_arrays +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp shift - -complist -A diff --git a/Functions/Completion/_autoload b/Functions/Completion/_autoload deleted file mode 100644 index 4f506baeb..000000000 --- a/Functions/Completion/_autoload +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp autoload - -complist -s '${^fpath}/*(N:t)' diff --git a/Functions/Completion/_bg_jobs b/Functions/Completion/_bg_jobs deleted file mode 100644 index 511bb8308..000000000 --- a/Functions/Completion/_bg_jobs +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp bg - -complist -z -P '%' diff --git a/Functions/Completion/_bindkey b/Functions/Completion/_bindkey deleted file mode 100644 index 8eddeb2a8..000000000 --- a/Functions/Completion/_bindkey +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp bindkey - -if [[ -mword 1 -*[DAN]* || -mcurrent -1 -*M ]]; then - complist -s '$(bindkey -l)' -else - complist -b -fi diff --git a/Functions/Completion/_builtin b/Functions/Completion/_builtin deleted file mode 100644 index d2b11226b..000000000 --- a/Functions/Completion/_builtin +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp builtin - -if [[ -position 2 -1 ]]; then - compsub -else - complist -eB -fi diff --git a/Functions/Completion/_cd b/Functions/Completion/_cd deleted file mode 100644 index f3ce67ec7..000000000 --- a/Functions/Completion/_cd +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp cd - -_files -W cdpath -g '*(-/)' diff --git a/Functions/Completion/_command b/Functions/Completion/_command deleted file mode 100644 index b2812de25..000000000 --- a/Functions/Completion/_command +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp command - -if [[ -position 2 -1 ]]; then - _normal "$@" -else - complist -em -fi diff --git a/Functions/Completion/_command_names b/Functions/Completion/_command_names deleted file mode 100644 index d3b8a109a..000000000 --- a/Functions/Completion/_command_names +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp -command- - -complist -c diff --git a/Functions/Completion/_compress b/Functions/Completion/_compress deleted file mode 100644 index 860aeb5b0..000000000 --- a/Functions/Completion/_compress +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp compress - -_files -g '*~*.Z' diff --git a/Functions/Completion/_condition b/Functions/Completion/_condition deleted file mode 100644 index 3e45e1b8f..000000000 --- a/Functions/Completion/_condition +++ /dev/null @@ -1,10 +0,0 @@ -#defcomp -condition- - -if [[ -current -1 -o ]]; then - complist -o -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -elif [[ -current -1 -nt || -current -1 -ot || -current -1 -ef ]]; then - _files -else - _files - complist -v -fi diff --git a/Functions/Completion/_configure b/Functions/Completion/_configure deleted file mode 100644 index de8d5fba5..000000000 --- a/Functions/Completion/_configure +++ /dev/null @@ -1,12 +0,0 @@ -#defcomp configure - -if [[ $PREFIX = *=* ]]; then - # Complete filenames after e.g. --prefix= - IPREFIX=${PREFIX%%=*}= - PREFIX=${PREFIX#*=} - complist -f -else - # Generate a list of options from configure --help - complist -s '$($COMMAND --help | - sed -n -e '\''s/^ *\(--[-a-z0-9]*\)[ =,].*$/\1/p'\'')' -fi diff --git a/Functions/Completion/_dd b/Functions/Completion/_dd deleted file mode 100644 index 2458541ea..000000000 --- a/Functions/Completion/_dd +++ /dev/null @@ -1,13 +0,0 @@ -#defcomp dd - -if [[ -iprefix conv= ]]; then - # If there's a comma present, ignore up to the last one. The - # test alone will have that effect. - [[ -string , ]] - complist -S, -q \ - -k '(ascii ebcdic ibm block unblock lcase ucase swab noerror sync)' -elif [[ -iprefix 'if=' || -iprefix 'of=' ]]; then - _files -else - complist -S '=' -k '(if of ibs obs bs cbs skip files seek count conv)' -fi diff --git a/Functions/Completion/_default b/Functions/Completion/_default deleted file mode 100644 index 8bcf14f6a..000000000 --- a/Functions/Completion/_default +++ /dev/null @@ -1,13 +0,0 @@ -#defcomp -default- - -# We first try the `compctl's. This is without first (-T) and default (-D) -# completion. If you want them add `-T' and/or `-D' to this command. -# If there is a `compctl' for the command we are working on, we return -# immediatly. If you want to use new style completion anyway, remove the -# `|| return'. Also, you may want to use new style completion if the -# `compctl' didn't produce any matches. In that case remove the `|| return' -# and at the line `[[ -nmatches 0 ]] || return' after `compcall'. - -compcall || return - -_files diff --git a/Functions/Completion/_dirs b/Functions/Completion/_dirs deleted file mode 100644 index c79080d58..000000000 --- a/Functions/Completion/_dirs +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp rmdir df du dircmp - -_files -/ '*(-/)' diff --git a/Functions/Completion/_disable b/Functions/Completion/_disable deleted file mode 100644 index 063b65a7d..000000000 --- a/Functions/Completion/_disable +++ /dev/null @@ -1,6 +0,0 @@ -#defcomp disable - -[[ -mcurrent -1 -*a* ]] && complist -ea -[[ -mcurrent -1 -*f* ]] && complist -eF -[[ -mcurrent -1 -*r* ]] && complist -ew -[[ ! -mcurrent -1 -* ]] && complist -eB diff --git a/Functions/Completion/_dvi b/Functions/Completion/_dvi deleted file mode 100644 index bb2fc293e..000000000 --- a/Functions/Completion/_dvi +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp xdvi dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype - -_files -g '*.(dvi|DVI)' diff --git a/Functions/Completion/_echotc b/Functions/Completion/_echotc deleted file mode 100644 index 85ebb97ce..000000000 --- a/Functions/Completion/_echotc +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp echotc - -complist -k '(al dc dl do le up al bl cd ce cl cr dc dl do ho is le ma nd nl se so up)' diff --git a/Functions/Completion/_enable b/Functions/Completion/_enable deleted file mode 100644 index 22ff53ee7..000000000 --- a/Functions/Completion/_enable +++ /dev/null @@ -1,6 +0,0 @@ -#defcomp enable - -[[ -mcurrent -1 -*a* ]] && complist -da -[[ -mcurrent -1 -*f* ]] && complist -dF -[[ -mcurrent -1 -*r* ]] && complist -dw -[[ ! -mcurrent -1 -* ]] && complist -dB diff --git a/Functions/Completion/_fc b/Functions/Completion/_fc deleted file mode 100644 index f0d2c03fd..000000000 --- a/Functions/Completion/_fc +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp fc - -if [[ -mcurrent -1 -*e ]]; then - complist -c -elif [[ -mcurrent -1 -[ARWI]## ]]; then - _files -fi diff --git a/Functions/Completion/_files b/Functions/Completion/_files deleted file mode 100644 index ab3006e39..000000000 --- a/Functions/Completion/_files +++ /dev/null @@ -1,10 +0,0 @@ -#autoload - -# Utility function for completing files of a given type or any file. -# In many cases you will want to call this one instead of _path_files(). - -local nm=$NMATCHES - -_path_files "$@" - -[[ $# -ne 0 && -nmatches nm ]] && _path_files diff --git a/Functions/Completion/_find b/Functions/Completion/_find deleted file mode 100644 index ca4f79908..000000000 --- a/Functions/Completion/_find +++ /dev/null @@ -1,21 +0,0 @@ -#defcomp find - -if [[ -mbetween -(ok|exec) \\\; ]]; then - _normal "$@" -elif [[ -iprefix - ]]; then - complist -s 'daystart {max,min,}depth follow noleaf version xdev \ - {a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links \ - {i,}{l,}name {no,}{user,group} path perm regex size true uid used \ - exec {f,}print{f,0,} ok prune ls' -elif [[ -position 1 ]]; then - complist -g '. ..' - _files -g '(-/)' -elif [[ -mcurrent -1 -((a|c|)newer|fprint(|0|f)) ]]; then - _files -elif [[ -current -1 -fstype ]]; then - complist -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' -elif [[ -current -1 -group ]]; then - complist -k groups -elif [[ -current -1 -user ]]; then - complist -u -fi diff --git a/Functions/Completion/_functions b/Functions/Completion/_functions deleted file mode 100644 index 8a352ea08..000000000 --- a/Functions/Completion/_functions +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp unfunction - -complist -F diff --git a/Functions/Completion/_gunzip b/Functions/Completion/_gunzip deleted file mode 100644 index 35a27e774..000000000 --- a/Functions/Completion/_gunzip +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp gunzip zcat - -_files -g '*.[gG][z]' diff --git a/Functions/Completion/_gzip b/Functions/Completion/_gzip deleted file mode 100644 index 3cda1e4ed..000000000 --- a/Functions/Completion/_gzip +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp gzip - -_files -g '*~*.[gG][zZ]' diff --git a/Functions/Completion/_hash b/Functions/Completion/_hash deleted file mode 100644 index a6109563d..000000000 --- a/Functions/Completion/_hash +++ /dev/null @@ -1,13 +0,0 @@ -#defcomp hash - -if [[ -mword 1 -*d* ]]; then - if [[ -string 1 '=' ]]; then - _path_files -g '*(-/)' - else - complist -n -q -S '=' - fi -elif [[ -string 1 '=' ]]; then - _files -g '*(*)' '*(-/)' -else - complist -m -q -S '=' -fi diff --git a/Functions/Completion/_hosts b/Functions/Completion/_hosts deleted file mode 100644 index 3acc327ac..000000000 --- a/Functions/Completion/_hosts +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp ftp ncftp ping rwho rup xping traceroute nslookup - -complist -k hosts diff --git a/Functions/Completion/_jobs b/Functions/Completion/_jobs deleted file mode 100644 index 018883c61..000000000 --- a/Functions/Completion/_jobs +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp fg jobs - -complist -j -P '%' diff --git a/Functions/Completion/_kill b/Functions/Completion/_kill deleted file mode 100644 index bf0e1d3f8..000000000 --- a/Functions/Completion/_kill +++ /dev/null @@ -1,8 +0,0 @@ -#defcomp kill - -if [[ -iprefix '-' ]]; then - complist -k "($signals[1,-3])" -else - complist -P '%' -j - complist -y _kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' -fi diff --git a/Functions/Completion/_kill_helper b/Functions/Completion/_kill_helper deleted file mode 100644 index d3e9aaf4a..000000000 --- a/Functions/Completion/_kill_helper +++ /dev/null @@ -1,3 +0,0 @@ -#autoload - -reply=( "$(ps 2>/dev/null)" ) diff --git a/Functions/Completion/_limits b/Functions/Completion/_limits deleted file mode 100644 index 35ccbe07e..000000000 --- a/Functions/Completion/_limits +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp limit unlimit - -complist -k "(${(j: :)${(f)$(limit)}%% *})" diff --git a/Functions/Completion/_main_complete b/Functions/Completion/_main_complete deleted file mode 100644 index 003a01785..000000000 --- a/Functions/Completion/_main_complete +++ /dev/null @@ -1,48 +0,0 @@ -#autoload - -# The main loop of the completion code. This is what is called when -# completion is attempted from the command line. -# The completion code gives us the special variables and the arguments -# from the command line are given as positional parameters. - -local comp name - -setopt localoptions nullglob rcexpandparam globdots -unsetopt markdirs globsubst shwordsplit nounset - -# An entry for `-first-' is the replacement for `compctl -T' -# Completion functions may set `COMPSKIP' to any value to make the -# main loops stop calling other completion functions. - -comp="$comps[-first-]" -if [[ ! -z "$comp" ]]; then - "$comp" "$@" - if (( $+COMPSKIP )); then - unset COMPSKIP - return - fi -fi - -# For arguments we use the `_normal function. - -if [[ $CONTEXT == argument || $CONTEXT == command ]]; then - _normal "$@" -else - # Let's see if we have a special completion definition for the other - # possible contexts. - - comp='' - - case $CONTEXT in - redirect) comp="$comps[-redirect-]";; - math) comp="$comps[-math-]";; - subscript) comp="$comps[-subscript-]";; - value) comp="$comps[-value-]";; - condition) comp="$comps[-condition-]";; - esac - - # If not, we use default completion, if any. - - [[ -z "$comp" ]] && comp="$comps[-default-]" - [[ -z "$comp" ]] || "$comp" "$@" -fi diff --git a/Functions/Completion/_make b/Functions/Completion/_make deleted file mode 100644 index d576b0308..000000000 --- a/Functions/Completion/_make +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp make gmake pmake - -complist -s "\$(awk '/^[a-zA-Z0-9][^/ ]+:/ {print \$1}' FS=: [mM]akefile)" diff --git a/Functions/Completion/_man b/Functions/Completion/_man deleted file mode 100644 index 8204fba0b..000000000 --- a/Functions/Completion/_man +++ /dev/null @@ -1,11 +0,0 @@ -#defcomp man -setopt localoptions rcexpandparam - -local rep -if [[ $2 = (<->*|ln) ]]; then - rep=( $manpath/(man|cat)$2/$PREFIX*$SUFFIX.<->*(N:t:r) ) -else - rep=( $manpath/(man|cat)*/$PREFIX*$SUFFIX.<->*(N:t:r) ) -fi - -(( $#rep )) && compadd -m $rep diff --git a/Functions/Completion/_mh b/Functions/Completion/_mh deleted file mode 100644 index 67ce49fd2..000000000 --- a/Functions/Completion/_mh +++ /dev/null @@ -1,70 +0,0 @@ -#defcomp folder comp inc mark refile repl scan show next prev rmm pick whom mhn mhpath mhpatch - -# Completion for all possible MH commands. -# Alter the following two to your own mh directory and the directory -# where standard mh library files live. (It works anyway, but this -# will save a little time.) -local mymhdir=~/Mail -local mhlib=/usr/lib/mh - -# To be on the safe side, check this exists and if not, get it anyway. -[[ -d $mymhdir ]] || mymhdir=$(mhpath +) - -if [[ -iprefix - ]]; then - # get list of options, which MH commands can generate themselves - # awk is just too icky to use for this, sorry. send me one if - # you come up with it. - compadd -m $($COMMAND -help | perl -ne 'if (/^\s*-\(?(\S+)/) { - $n = $1; - $n =~ s/\)//g; - print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n"; - }') - return -elif [[ -iprefix '+' || -iprefix '@' || -current -1 -draftfolder ]]; then - # Complete folder names. - local mhpath - if [[ $IPREFIX != '@' ]]; then - [[ $IPREFIX = '+' ]] || IPREFIX=+ - mhpath=$mymhdir - else - mhpath=$(mhpath) - fi - - # painless, or what? - complist -W mhpath -/ -elif [[ -mcurrent -1 -(editor|(whatnow|rmm|show|more)proc) ]]; then - complist -c -elif [[ -current -1 -file ]]; then - complist -f -elif [[ -mcurrent -1 -(form|audit|filter) ]]; then - # Need some MH template file, which may be in our own MH directory - # or with the standard library. - local mhfpath - # This is the only place we need mhlib, so leave the test till here. - [[ -d $mhlib ]] || { mhlib=$(mhparam mhlproc); mhlib=$mhlib:h; } - mhfpath=($mymhdir $mhlib) - - complist -W mhfpath -g '*(.)' -elif [[ -mcurrent -1 -(no|)cc ]]; then - compadd -m all to cc me -elif [[ -mcurrent -1 -[rw]cache ]]; then - compadd -m public private never ask -else - # Generate sequences. - local foldnam folddir f - for f in $argv; do - [[ $f = [@+]* ]] && foldnam=$f - done - if [[ $foldnam = '+'* ]]; then - folddir=$mymhdir/${foldnam#+} - elif [[ $foldnam = '@'* ]]; then - folddir=$(mhpath)/${foldnam#@} - else - folddir=$(mhpath) - # leaving foldnam empty works here - fi - - complist -s '$(mark $foldnam | awk -F: '\''{ print $1 }'\'')' - compadd -m reply next cur prev first last all unseen - complist -W folddir -g '<->' -fi diff --git a/Functions/Completion/_most_recent_file b/Functions/Completion/_most_recent_file deleted file mode 100644 index 69900e6ff..000000000 --- a/Functions/Completion/_most_recent_file +++ /dev/null @@ -1,3 +0,0 @@ -#defkeycomp expand-or-complete \C-xm - -complist -g '*(om[1])' diff --git a/Functions/Completion/_normal b/Functions/Completion/_normal deleted file mode 100644 index 22cc1decf..000000000 --- a/Functions/Completion/_normal +++ /dev/null @@ -1,56 +0,0 @@ -#autoload - -local comp cmd1 cmd2 pat val name - -# Completing in command position? If not we set up `cmd1' and `cmd2' as -# two strings we have search in the completion definition arrays (e.g. -# a path and the last path name component). - -if [[ $CONTEXT == command ]]; then - comp="$comps[-command-]" - [[ -z "$comp" ]] || "$comp" "$@" - return -elif [[ "$COMMAND[1]" == '=' ]]; then - eval cmd1\=$COMMAND - cmd2="$COMMAND[2,-1]" -elif [[ "$COMMAND" == */* ]]; then - cmd1="$COMMAND" - cmd2="${COMMAND:t}" -else - cmd1="$COMMAND" - eval cmd2=$(whence -p $COMMAND) -fi - -# See if there are any matching pattern completions. - -if (( $#patcomps )); then - for i in "$patcomps[@]"; do - pat="${i% *}" - val="${i#* }" - if [[ "$cmd1" == $~pat || "$cmd2" == $~pat ]]; then - "$val" "$@" - if (( $+COMPSKIP )); then - unset COMPSKIP - return - fi - fi - done -fi - -# Now look up the two names in the normal completion array. - -name="$cmd1" -comp="$comps[$cmd1]" - -if [[ -z "$comp" ]]; then - name="$cmd2" - comp="$comps[$cmd2]" -fi - -# And generate the matches, probably using default completion. - -if [[ -z "$comp" ]]; then - name=-default- - comp="$comps[-default-]" -fi -[[ -z "$comp" ]] || "$comp" "$@" diff --git a/Functions/Completion/_path_files b/Functions/Completion/_path_files deleted file mode 100644 index 7db364b7d..000000000 --- a/Functions/Completion/_path_files +++ /dev/null @@ -1,272 +0,0 @@ -#autoload - -# Utility function for in-path completion. -# First argument should be an complist-option (e.g. -f, -/, -g). The other -# arguments should be glob patterns, one per argument. -# -# E.g.: _path_files -g '*.tex' '*.texi' -# -# This is intended as a replacement for `complist -f', `complist -/', and -# `complist -g ...' (but don't use it with other options). -# -# You may also give the `-W <spec>' option as with `compctl' and `complist', -# but only as the first argument. -# -# This function also accepts an optional `-F <string>' option as its first -# argument or just after the `-W <spec>'. This can be used to define file -# name extension (a la `fignore'). Files with such an extension will not -# be considered possible completions. -# -# This function behaves as if you have a matcher definition like: -# compctl -M 'r:|[-.,_/]=* r:|=* m:{a-z}={A-Z} m:-=_ m:.=,' \ -# 'm:{a-z}={A-Z} l:|=* r:|=*' -# so you may want to modify this. - -local nm prepaths str linepath realpath donepath patstr prepath testpath rest -local tmp1 collect tmp2 suffixes i ignore - -setopt localoptions nullglob rcexpandparam globdots extendedglob -unsetopt markdirs globsubst shwordsplit nounset - -# Get the optional `-W' option and its argument. -if [[ "$1" = -W ]]; then - tmp1="$2" - if [[ "$tmp1[1]" = '(' ]]; then - prepaths=( $tmp1[2,-2]/ ) - else - prepaths=( ${(P)${tmp1}} ) - [[ $#prepaths -eq 0 ]] && prepaths=( $tmp1/ ) - fi - [[ $#prepaths -eq 0 ]] && prepaths=( '' ) - shift 2 -else - prepaths=( '' ) -fi - -# Get the optional `-F' option and its argument. -if [[ "$1" = -F ]]; then - ignore=(-F "$2") - shift 2 -else - ignore='' -fi - -# str holds the whole string from the command line with a `*' between -# the prefix and the suffix. - -str="${PREFIX:q}*${SUFFIX:q}" - -# We will first try normal completion called with `complist', but only if we -# weren't given a `-F' option. - -if [[ -z "$ignore" ]]; then - # First build an array containing the `-W' option, if there is any and we - # want to use it. We don't want to use it if the string from the command line - # is a absolute path or relative to the current directory. - - if [[ -z "$tmp1[1]" || "$str[1]" = [~/] || "$str" = (.|..)/* ]]; then - tmp1=() - else - tmp1=(-W "( $prepaths )") - fi - - # Now call complist. - - nm=$NMATCHES - if [[ $# -eq 0 ]]; then - complist "$tmp1[@]" -f - elif [[ "$1" = -g ]]; then - complist "$tmp1[@]" -g "$argv[2,-1]" - shift - else - complist "$tmp1[@]" $1 - shift - fi - - # If this generated any matches, we don't wnat to do in-path completion. - - [[ -nmatches nm ]] || return - - # No `-F' option, so we want to use `fignore'. - - ignore=(-F fignore) -fi - -# If we weren't given any file patterns as arguments, we trick ourselves -# into believing that we were given the pattern `*'. This is just to simplify -# the following code. - -[[ -z "$1" ]] && 1='*' - -# Now let's have a closer look at the string to complete. - -if [[ "$str[1]" = \~ ]]; then - # It begins with `~', so remember anything before the first slash to be able - # to report it to the completion code. Also get an expanded version of it - # (in `realpath'), so that we can generate the matches. Then remove that - # prefix from the string to complete, set `donepath' to build the correct - # paths and make sure that the loop below is run only once with an empty - # prefix path by setting `prepaths'. - - linepath="${str%%/*}/" - eval realpath\=path - str="${str#*/}" - donepath='' - prepaths=( '' ) -else - # If the string does not start with a `~' we don't remove a prefix from the - # string. - - liniepath='' - realpath='' - - if [[ "$str[1]" = / ]]; then - # If it is a absolut path name, we remove the first slash and put it in - # `donepath' meaning that we treat it as the path that was already handled. - # Also, we don't use the paths from `-W'. - - str="$str[2,-1]" - donepath='/' - prepaths=( '' ) - else - # The common case, we just use the string as it is, unless it begins with - # `./' or `../' in which case we don't use the paths from `-W'. - - [[ "$str" = (.|..)/* ]] && prepaths=( '' ) - donepath='' - fi -fi - -# First we skip over all pathname components in `str' which really exist in -# the file-system, so that `/usr/lib/l<TAB>' doesn't offer you `lib' and -# `lib5'. Pathname components skipped this way are taken from `str' and added -# to `donepath'. - -while [[ "$str" = */* ]] do - [[ -e "$realpath$donepath${str%%/*}" ]] || break - donepath="$donepath${str%%/*}/" - str="${str#*/}" -done - -# Now build the glob pattern. As noted above, this function behaves as if -# a global matcher with two matching specifications are given. - -if [[ -matcher 1 ]]; then - patstr="$str:gs/,/*,/:gs/_/*_/:gs./.*/.:gs/-/*[-_]/:gs/./*[.,]/:gs-*[.,]*[.,]*/-../-:gs.**.*." -else - patstr="${str%/*}/*${str##*/}*" - patstr="$patstr:gs./.*/.:gs.**.*." -fi - -# Finally, generate the matches. First we loop over all the paths from `-W'. -# Note that in this loop `str' is used as a modifyable version of `patstr' -# and `testpath' is a modifyable version of `donepath'. - -for prepath in "$prepaths[@]"; do - str="$patstr" - testpath="$donepath" - - # The second loop tests the components of the path in `str' to get the - # possible matches. - - while [[ "$str" = */* ]] do - # `rest' is the pathname after the first slash that is left. In `tmp1' - # we get the globbing matches for the pathname component currently - # handled. - - rest="${str#*/}" - tmp1="${prepath}${realpath}${testpath}(#l)${str%%/*}(-/)" - tmp1=( $~tmp1 ) - - if [[ $#tmp1 -eq 0 ]]; then - # If this didn't produce any matches, we don't need to test this path - # any further, so continue with the next `-W' path, if any. - - continue 2 - elif [[ $#tmp1 -gt 1 ]]; then - # If it produced more than one match, we want to remove those which - # don't have possible following pathname components matching the - # rest of the string we are completing. (The case with only one - # match is handled below.) - # In `collect' we will collect those of the produced pathnames that - # have a matching possible path-suffix. In `suffixes' we build an - # array containing strings build from the rest of the string to - # complete and the glob patterns we were given as arguments. - - collect=() - suffixes=( $rest$@ ) - suffixes=( "${(@)suffixes:gs.**.*.}" ) - - # In the loop the prefixes from the `tmp1' array produced above and - # the suffixes we just built are used to produce possible matches - # via globbing. - - for i in $tmp1; do - tmp2=( $~i/(#l)$~suffixes ) - [[ $#tmp2 -ne 0 ]] && collect=( $collect $i ) - done - - # If this test showed that none of the matches from the glob in `tmp1' - # has a possible sub-path matching what's on the line, we give up and - # continue with the next `-W' path. - - if [[ $#collect -eq 0 ]]; then - continue 2 - elif [[ $#collect -ne 1 ]]; then - # If we have more than one possible match, this means that the - # pathname component currently handled is ambiguous, so we give - # it to the completion code. - # First we build the full path prefix in `tmp1'. - - tmp1="$prepath$realpath$testpath" - - # Now produce all matching pathnames in `collect'. - - collect=( $~collect/(#l)$~suffixes ) - - # And then remove the common path prefix from all these matches. - - collect=( ${collect#$tmp1} ) - - # Finally, we add all these matches with the common (unexpanded) - # pathprefix (the `-p' option), the path-prefix (the `-W' option) - # to allow the completion code to test file type, and the path- - # suffix (the `-s' option). We also tell the completion code that - # these are file names and that `fignore' should be used as usual - # (the `-f' and `-F' options). - - for i in $collect; do - compadd -p "$linepath$testpath" -W "$tmp1" -s "/${i#*/}" -f "$ignore[@]" - "${i%%/*}" - done - - # We have just finished handling all the matches from above, so we - # can continue with the next `-W' path. - - continue 2 - fi - # We reach this point if only one of the path prefixes in `tmp1' - # has a existing path-suffix matching the string from the line. - # In this case we accept this match and continue with the next - # path-name component. - - tmp1=( "$collect[1]" ) - fi - # This is also reached if the first globbing produced only one match - # in this case we just continue with the next pathname component, too. - - tmp1="$tmp1[1]" - testpath="$testpath${tmp1##*/}/" - str="$rest" - done - - # We are here if all pathname components except the last one (which is still - # not tested) are unambiguous. So we add matches with the full path prefix, - # no path suffix, the `-W' we are currently handling, all the matches we - # can produce in this directory, if any. - - tmp1="$prepath$realpath$testpath" - suffixes=( $str$@ ) - suffixes=( "${(@)suffixes:gs.**.*.}" ) - tmp2=( $~tmp1(#l)$~suffixes ) - compadd -p "$linepath$testpath" -W "$prepath$realpath$testpath" -f "$ignore[@]" - ${tmp2#$tmp1} -done diff --git a/Functions/Completion/_pdf b/Functions/Completion/_pdf deleted file mode 100644 index 7d7756c3e..000000000 --- a/Functions/Completion/_pdf +++ /dev/null @@ -1,3 +0,0 @@ -function acroread - -_files -g '*.(pdf|PDF)' diff --git a/Functions/Completion/_precommand b/Functions/Completion/_precommand deleted file mode 100644 index 2cf661147..000000000 --- a/Functions/Completion/_precommand +++ /dev/null @@ -1,5 +0,0 @@ -#defcomp - nohup nice eval time rusage noglob nocorrect exec - -[[ -position 1 -1 ]] - -_normal "$@" diff --git a/Functions/Completion/_ps b/Functions/Completion/_ps deleted file mode 100644 index 6bc0643b2..000000000 --- a/Functions/Completion/_ps +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp gs ghostview gview psnup psselect pswrap pstops pstruct lpr - -_files -g '*([pP][sS]|eps)' diff --git a/Functions/Completion/_rcs b/Functions/Completion/_rcs deleted file mode 100644 index 537db6278..000000000 --- a/Functions/Completion/_rcs +++ /dev/null @@ -1,9 +0,0 @@ -#defcomp co ci rcs - -[[ $COMMAND = ci || $COMMAND = rcs ]] && _files - -if [[ $NMATCHES -eq 0 && -d RCS && $COMMAND != ci ]]; then - local rep - rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//)) - (( $#rep )) && compadd -m $rep -fi diff --git a/Functions/Completion/_rlogin b/Functions/Completion/_rlogin deleted file mode 100644 index e36554f23..000000000 --- a/Functions/Completion/_rlogin +++ /dev/null @@ -1,9 +0,0 @@ -#defcomp rlogin rsh ssh - -if [[ -position 1 ]]; then - complist -k hosts -elif [[ -position 2 ]]; then - complist -k '(-l)' -else - complist -u -fi diff --git a/Functions/Completion/_sched b/Functions/Completion/_sched deleted file mode 100644 index ee785879b..000000000 --- a/Functions/Completion/_sched +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp sched - -[[ -position 2 -1 ]] && compsub diff --git a/Functions/Completion/_set b/Functions/Completion/_set deleted file mode 100644 index e3069f134..000000000 --- a/Functions/Completion/_set +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp set - -if [[ -mcurrent -1 [-+]o ]]; then - complist -o -elif [[ -current -1 -A ]]; then - complist -A -fi diff --git a/Functions/Completion/_setopt b/Functions/Completion/_setopt deleted file mode 100644 index 4abb3ccee..000000000 --- a/Functions/Completion/_setopt +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp setopt - -local nm=$NMATCHES - -complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \ - -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)' -[[ -nmatches nm ]] && complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o diff --git a/Functions/Completion/_source b/Functions/Completion/_source deleted file mode 100644 index 94e3fbeb1..000000000 --- a/Functions/Completion/_source +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp source - -if [[ -position 2 -1 ]]; then - compsub -else - _files -fi diff --git a/Functions/Completion/_strip b/Functions/Completion/_strip deleted file mode 100644 index 6962ac455..000000000 --- a/Functions/Completion/_strip +++ /dev/null @@ -1,2 +0,0 @@ -#defcomp strip -_files -g '*(*)' diff --git a/Functions/Completion/_stty b/Functions/Completion/_stty deleted file mode 100644 index 6b54b5007..000000000 --- a/Functions/Completion/_stty +++ /dev/null @@ -1,16 +0,0 @@ -#defcomp stty - -if [[ -mcurrent -1 \ - (*erase|discard|status|dsusp|intr|kill|lnext|quit|reprint|start|s*p) ]] -then - compadd -m -Q '^-' '^h' '^?' '^c' '^u' -else - [[ -string '-' || -string '+' ]] - compadd -m rows columns intr quit erase kill eof eol \ - eol2 start stop susp dsusp reprint discard werase lnext \ - parenb parodd cs8 cstopb hupcl cread clocal parext \ - ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl iuclc \ - ixon ixany ixoff imaxbel isig icanon xcase echo echoe echok \ - echonl noflsh tostop echoctl echoprt echoke flusho pending iexten \ - opost olcuc onlcr ocrnl onocr onlret ofill ofdel -fi diff --git a/Functions/Completion/_subscript b/Functions/Completion/_subscript deleted file mode 100644 index 2b827a117..000000000 --- a/Functions/Completion/_subscript +++ /dev/null @@ -1,4 +0,0 @@ -#defcomp -subscript- - -_compalso -math- "$@" -[[ ${(Pt)${COMMAND}} = assoc* ]] && complist -k "( ${(kP)${COMMAND}} )" diff --git a/Functions/Completion/_tar b/Functions/Completion/_tar deleted file mode 100644 index 91767e44d..000000000 --- a/Functions/Completion/_tar +++ /dev/null @@ -1,11 +0,0 @@ -#defcomp tar - -local nm=$NMATCHES tf="$2" - -if [[ ( -mword 1 *t*f* || -mword 1 *x*f* ) && -position 3 100000 ]]; then - complist -k "( $(tar tf $tf) )" -elif [[ -mword 1 *c*f* && -position 3 100000 ]]; then - _files -elif [[ -mcurrent -1 *f* && -position 2 ]]; then - _files -g '*.(tar|TAR)' -fi diff --git a/Functions/Completion/_tex b/Functions/Completion/_tex deleted file mode 100644 index 1f645e2a2..000000000 --- a/Functions/Completion/_tex +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp tex latex slitex - -_files -g '*.(tex|TEX|texinfo|texi)' diff --git a/Functions/Completion/_trap b/Functions/Completion/_trap deleted file mode 100644 index 59e81c589..000000000 --- a/Functions/Completion/_trap +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp trap - -if [[ -position 1 ]]; then - complist -c -else - complist -k signals -fi diff --git a/Functions/Completion/_uncompress b/Functions/Completion/_uncompress deleted file mode 100644 index e25805d50..000000000 --- a/Functions/Completion/_uncompress +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp uncompress zmore - -_files -g '*.Z' diff --git a/Functions/Completion/_unhash b/Functions/Completion/_unhash deleted file mode 100644 index fe40c25a2..000000000 --- a/Functions/Completion/_unhash +++ /dev/null @@ -1,6 +0,0 @@ -#defcomp unhash - -[[ -mword 1 -*d* ]] && complist -n -[[ -mword 1 -*a* ]] && complist -a -[[ -mword 1 -*f* ]] && complist -F -[[ ! -mword 1 -* ]] && complist -m diff --git a/Functions/Completion/_unsetopt b/Functions/Completion/_unsetopt deleted file mode 100644 index 90d642b51..000000000 --- a/Functions/Completion/_unsetopt +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp unsetopt - -local nm=$NMATCHES - -complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \ - -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)' -[[ -nmatches nm ]] && complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o diff --git a/Functions/Completion/_vars b/Functions/Completion/_vars deleted file mode 100644 index 7153b6f38..000000000 --- a/Functions/Completion/_vars +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp -math- getopts read unset vared - -complist -v diff --git a/Functions/Completion/_vars_eq b/Functions/Completion/_vars_eq deleted file mode 100644 index fcbb0148c..000000000 --- a/Functions/Completion/_vars_eq +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp declare export integer local readonly typeset - -complist -v -q -S '=' diff --git a/Functions/Completion/_wait b/Functions/Completion/_wait deleted file mode 100644 index 34bc53ee3..000000000 --- a/Functions/Completion/_wait +++ /dev/null @@ -1,4 +0,0 @@ -#defcomp wait - -complist -P '%' -j -complist -y _kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' diff --git a/Functions/Completion/_which b/Functions/Completion/_which deleted file mode 100644 index 324256e3d..000000000 --- a/Functions/Completion/_which +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp which whence where type - -complist -caF diff --git a/Functions/Completion/_x_options b/Functions/Completion/_x_options deleted file mode 100644 index cc469286d..000000000 --- a/Functions/Completion/_x_options +++ /dev/null @@ -1,5 +0,0 @@ -#defpatcomp */X11/* - -# A simple pattern completion, just as an example. - -complist -J options -k '(-display -name -xrm)' diff --git a/Functions/Completion/_xfig b/Functions/Completion/_xfig deleted file mode 100644 index fcd2bba9f..000000000 --- a/Functions/Completion/_xfig +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp xfig - -_files -g '*.fig' diff --git a/Functions/Completion/_zftp b/Functions/Completion/_zftp deleted file mode 100644 index 4ff707cc6..000000000 --- a/Functions/Completion/_zftp +++ /dev/null @@ -1,50 +0,0 @@ -#defpatcomp zf* - -# Don't try any more completion after this. -COMPSKIP=1 - -# Completion for zftp builtin and zf* functions. The functions -# zfcd_match and zfget_match (used for old-style completion) -# need to be installed for remote file and directory completion to work. - -local subcom - -if [[ $COMMAND = zftp ]]; then - if [[ $CURRENT -eq 1 ]]; then - compadd -m open params user login type ascii binary mode put \ - putat get getat append appendat ls dir local remote mkdir rmdir - return - fi - subcom=$1 -else - subcom=$COMMAND -fi - -case $subcom in - *(cd|ls|dir)) - # complete remote directories; we could be smarter about hiding prefixes - zfcd_match $PREFIX $SUFFIX - (( $#reply )) && compadd -m -S/ -q $reply - ;; - - *(get(|at)|gcp|delete|remote)) - # complete remote files - zfget_match $PREFIX $SUFFIX - (( $#reply )) && compadd -F fignore -m $reply - ;; - - *(put(|at)|pcp)) - # complete local files - _files - ;; - - *(open|anon|params)) - # complete hosts: should do cleverer stuff with user names - complist -k hosts - ;; - - *) - # dunno... try ordinary completion after all. - unset COMPSKIP - ;; -esac diff --git a/Functions/Completion/_zle b/Functions/Completion/_zle deleted file mode 100644 index bb1102e74..000000000 --- a/Functions/Completion/_zle +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp zle - -if [[ -word 1 -N && -position 3 ]]; then - complist -F -else - complist -b -fi diff --git a/Functions/Completion/_zmodload b/Functions/Completion/_zmodload deleted file mode 100644 index 112acb57c..000000000 --- a/Functions/Completion/_zmodload +++ /dev/null @@ -1,9 +0,0 @@ -#defcomp zmodload - -if [[ -mword 1 -*(a*u|u*a)* || -mword 1 -*a* && -position 3 -1 ]]; then - complist -B -elif [[ -mword 1 -*u* ]]; then - complist -s '$(zmodload)' -else - complist -s '${^module_path}/*(N:t:r)' -fi diff --git a/Functions/Completion/dump b/Functions/Completion/dump deleted file mode 100644 index ad5547bea..000000000 --- a/Functions/Completion/dump +++ /dev/null @@ -1,89 +0,0 @@ -# This is a file to be sourced to dump the definitions for new-style -# completion defined by 'init' in the same directory. For best results, -# it should be run immediately after init, before any of the completions -# have been autoloaded. The output should be directed into the "init.dump" -# in the same directory as init. If you rename init, just stick .dump onto -# the end of whatever you have called it and put it in the same directory. -# -# You will need to update the dump every time you add a new completion. -# To do this, simply remove the .dump file, start a new shell, and -# create the .dump file as before. -# -# It relies on KSH_ARRAYS not being set. - -# Print the number of files used for completion. This is used in init -# to see if auto-dump should re-dump the dump-file. - -_d_file=${COMPDUMP-${0:h}/init.dump} - -_d_files=( ${^~fpath}/_*~*~ ) - -print "#files: $#_d_files" > $_d_file - -unset _d_files - -# First dump the arrays comps and patcomps. The quoting hieroglyphyics -# ensure that a single quote inside a variable is itself correctly quoted. - -print "comps=(" >> $_d_file -for _d_f in ${(k)comps}; do - print -r - "'${_d_f//\'/'\\''}'" "'${comps[$_d_f]//\'/'\\''}'" -done >> $_d_file -print ")" >> $_d_file - -if (( $#patcomps )); then - print "\npatcomps=(" >> $_d_file - for _d_f in "$patcomps[@]"; do - print -r - "'${_d_f//\'/'\\''}'" - done >> $_d_file - print ")" >> $_d_file -fi - -print >> $_d_file - -# Now dump the key bindings. We dump all bindings for zle widgets -# whose names start with a underscore. -# We need both the zle -C's and the bindkey's to recreate. - -_d_bks=() -zle -lL | - while read -rA _d_line; do - if [[ ${_d_line[5]} = _* ]]; then - print -r - ${_d_line} - _d_bks=($_d_bks ${_d_line[3]}) - fi - done >> $_d_file -bindkey | - while read -rA _d_line; do - if [[ ${_d_line[2]} = (${(j.|.)~_d_bks}) ]]; then - print -r "bindkey '${_d_line[1][2,-2]}' ${_d_line[2]}" - fi - done >> $_d_file - -print >> $_d_file - - -# Autoloads: whence -w produces "_d_foo: function", so look for -# all functions beginning with `_'. - -_d_als=($(whence -wm '_*' | -while read -rA _d_line; do - [[ ${_d_line[2]} = function ]] && print -r - ${_d_line[1]%:} -done)) - -# print them out: about six to a line looks neat - -while (( $#_d_als )); do - print -n autoload - for (( _i = 0; _i < 6; _i++ )); do - if (( $#_d_als )); then - print -n " $_d_als[1]" - shift _d_als - fi - done - print -done >> $_d_file - -print >> $_d_file - -unset _d_line _d_zle _d_bks _d_als _d_f _f_file diff --git a/Functions/Completion/init b/Functions/Completion/init deleted file mode 100644 index a40c5f61b..000000000 --- a/Functions/Completion/init +++ /dev/null @@ -1,253 +0,0 @@ -# Initialisation for new style completion. This mainly contains some helper -# function and aliases. Everything else is split into different files in this -# directory that will automatically be made autoloaded (see the end of this -# file). -# The names of the files that will be considered for autoloading have to -# start with two underscores (like `__setopt). -# The first line of these files will be read and has to say what should be -# done with its contents: -# -# `#function <names ...>' -# if the first line looks like this, the file is -# autoloaded as a function and that function will -# be called to generate the matches when completing -# for one of the commands whose <name> is given -# -# `#array <names ...>' -# with a first line like this, the filename is taken as -# the name of an array; when trying to generate matches -# for the command <name>, the file will be sourced and -# should define this array, the builtin `complist' will -# then be called with the elements of this array as its -# arguments; this is intended for simple definitions -# for which you don't need a shell function -# -# `#pattern-function <pattern>' -# this defines a function that should be called to generate -# matches for commands whose name matches <pattern>; note -# that only one pattern may be given -# -# `#pattern-array <pattern>' -# like `#pattern-function' but defining an array -# -# `#key-function <style> [ <key-sequence> ... ] -# this is used to bind special completions to all the given -# <key-sequence>(s). The <style> is the name of one of the built-in -# completion widgets (complete-word, delete-char-or-list, -# expand-or-complete, expand-or-complete-prefix, list-choices, -# menu-complete, menu-expand-or-complete, or reverse-menu-complete). -# This creates a widget behaving like <style> so that the -# completions are chosen as given in the the rest of the file, -# rather than by the context. The widget has the same name as -# the autoload file and can be bound using bindkey in the normal way. -# -# `#key-array <style> [ <key-sequence> ... ] -# like `#key-function', but defining an array instead -# -# `#helper' -# this is for helper functions that are not used to -# generate matches, but should automatically be loaded -# when they are called -# -# Note that no white space is allowed between the `#' and the rest of -# the string. - - -# An associative array for completions definitions. The keys of the entries -# are the names of the command, the values are names of functions or variables -# that are to be used to generate the matches. -# Pattern completions will be stored in an normal array named `patcomps'. -# Completion definitions bound directly to keys are stored in an assoc array -# named `keycomps'. - -typeset -A comps -typeset -A keycomps - - -# This may be used to define completion handlers. The first argument is the -# name of the function or variable containing the definition, the other -# arguments are the command names for which this definition should be used. -# With only one argument the function/variable-name __$1 is used. -# If given the `-a' option, the function is defined as being autoloaded. - -defcomp() { - local name autol='' - - if [[ "$1" = -a ]]; then - shift - autol=yes - fi - if [[ $# -eq 1 ]]; then - comps[$1]="__$1" - [[ -z "$autol" ]] || autoload "__$1" - else - name="$1" - shift - for i; do - comps[$i]="$name" - done - [[ -z "$autol" ]] || autoload "$name" - fi -} - - -# Almost like `defcomp', but this always gets two arguments: the name of a -# variable or function describing what should be completed and the pattern -# that will be compared to the command names for which completion is attempted. - -defpatcomp() { - if [[ "$1" = -a ]]; then - shift - autoload "$1" - fi - if (( $+patcomps )) then - patcomps=("$patcomps[@]" "$2 $1" ) - else - patcomps=( "$2 $1" ) - fi -} - - -# This is used to define completion handlers directly bound to keys. The -# first argument is as for `defcomp', giving the handler. The second -# argument is the name of one of the built-in completion widgets. Any -# remaining arguments are used as key sequences to bind the widget. -# Typing that key sequence will complete the word the cursor is on -# according to the completion definition given and will behave as if the -# built-in completion widget was used. - -defkeycomp() { - local name - - if [[ "$1" = -a ]]; then - shift - autoload "$1" - name="$1" - elif [[ "${1[1]}" = ' ' ]]; then - name="${1:t}" - else - name="$1" - fi - keycomps[$name]="$1" - shift - zle -C "$name" "$1" __main_key_complete - shift - while (( $# )); do - bindkey "$1" "$name" - shift - done -} - -# These can be used to easily save and restore the state of the special -# variables used by the completion code. - -alias compsave='local _oprefix _oiprefix _oargv _ocurrent; \ - _oprefix="$PREFIX"; \ - _oiprefix="$IPREFIX"; \ - _oargv=( "$@" ); \ - _ocurrent="$CURRENT"' -alias compreset='PREFIX="$_oprefix"; \ - IPREFIX="$_oiprefix"; \ - argv=( "$_oargv[@]" ); \ - CURRENT="$_ocur"' - - -# This is an easy way to get completion for sub-commands. - -alias compsub='__normal "$@" || return 1' - - -# This searches $1 in the array for normal completions and calls the result. - -compalso() { - local tmp - - tmp="$comps[$1]" - [[ -z "$tmp" ]] || callcomplete comps "$1" "$@" -} - - -# This generates matches. The first argument is the name of one of the -# arrays containing completion definitions. The second argument is the index -# into this array. The other arguments are the positional parameters to give -# to the completion function (containing the arguments from the command line). - -callcomplete() { - local file def - - # Get the definition from the array. - - eval "def=\$${1}[${2}]" - - # If the definition starts with a space then this means that we should - # source a file to get the definition for an array. - - if [[ "$def[1]" = ' ' ]]; then - # The definition starts with a space, so source the file and change - # the definition. - - file="$def[2,-1]" - builtin . "$file" - def="${file:t}" - eval "${1}[${2}]=$def" - fi - - # Get rid of the array-name and -index. - - shift 2 - if [[ ${(P)+def} -eq 1 ]]; then - # It is a parameter name, call complist directly. - - complist "${(@P)def}" - else - # Otherwise it's a function name, call this function. - - "$def" "$@" - fi -} - - -# Now we make the files automatically autoloaded. - -local dir file line func - -for dir in $fpath; do - [[ $dir = . ]] && continue - for file in $dir/__*~*~(N); do - read -rA line < $file - func=$line[1] - shift line - if [[ $func = '#function' ]]; then - defcomp -a ${file:t} "${line[@]}" - elif [[ $func = '#array' ]]; then - defcomp " $file" "${line[@]}" - elif [[ $func = '#pattern-function' ]]; then - defpatcomp -a ${file:t} "${line[@]}" - elif [[ $func = '#pattern-array' ]]; then - defcomp " $file" "${line[@]}" - elif [[ $func = '#key-function' ]]; then - defkeycomp -a "${file:t}" "${line[@]}" - elif [[ $func = '#key-array' ]]; then - defkeycomp " $file" "${line[@]}" - elif [[ $func = '#helper' ]]; then - autoload ${file:t} - fi - done -done - - -# Finally we make all this be called by changing the key bindings. - -bindkey | while read -A line; do - if [[ "$line[2]" = complete-word || - "$line[2]" = delete-char-or-list || - "$line[2]" = expand-or-complete || - "$line[2]" = expand-or-complete-prefix || - "$line[2]" = list-choices || - "$line[2]" = menu-complete || - "$line[2]" = menu-expand-or-complete || - "$line[2]" = reverse-menu-complete ]]; then - zle -C __complete_$line[2] $line[2] __main_complete - bindkey "${line[1][2,-2]}" __complete_$line[2] - fi - done |