mirror of
				git://git.code.sf.net/p/zsh/code
				synced 2025-10-31 18:10:56 +01:00 
			
		
		
		
	Sync up with zsh-3_1_6-pws-1.
This commit is contained in:
		
							parent
							
								
									5714953c51
								
							
						
					
					
						commit
						8d1b4b1358
					
				
					 169 changed files with 0 additions and 4700 deletions
				
			
		
							
								
								
									
										5
									
								
								.lastloc
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								.lastloc
									
										
									
									
									
								
							|  | @ -1,5 +0,0 @@ | |||
| (("/home/user2/pws/src/zsh-3.1.5/patchlist.txt" . 861) | ||||
|  ("/home/user2/pws/src/zsh-3.1.5/patch-match" . 74776) | ||||
|  ("/home/user2/pws/src/zsh-3.1.5/sven_fix2.dif" . 6081) | ||||
|  ("/home/user2/pws/src/zsh-3.1.5/ci_notes.txt" . 1267) | ||||
|  ("/home/user2/pws/src/zsh-3.1.5/configure.in" . 28530)) | ||||
|  | @ -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. | ||||
|  | @ -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 )) | ||||
|  | @ -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 | ||||
|  | @ -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[@]" | ||||
|  | @ -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' | ||||
|  | @ -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)' | ||||
|  | @ -1,83 +0,0 @@ | |||
| #
 | ||||
| # Basic Makefile definitions
 | ||||
| #
 | ||||
| # Copyright (c) 1995-1997 Richard Coleman
 | ||||
| # All rights reserved.
 | ||||
| #
 | ||||
| # Permission is hereby granted, without written agreement and without
 | ||||
| # license or royalty fees, to use, copy, modify, and distribute this
 | ||||
| # software and to distribute modified versions of this software for any
 | ||||
| # purpose, provided that the above copyright notice and the following
 | ||||
| # two paragraphs appear in all copies of this software.
 | ||||
| #
 | ||||
| # In no event shall Richard Coleman or the Zsh Development Group be liable
 | ||||
| # to any party for direct, indirect, special, incidental, or consequential
 | ||||
| # damages arising out of the use of this software and its documentation,
 | ||||
| # even if Richard Coleman and the Zsh Development Group have been advised of
 | ||||
| # the possibility of such damage.
 | ||||
| #
 | ||||
| # Richard Coleman and the Zsh Development Group specifically disclaim any
 | ||||
| # warranties, including, but not limited to, the implied warranties of
 | ||||
| # merchantability and fitness for a particular purpose.  The software
 | ||||
| # provided hereunder is on an "as is" basis, and Richard Coleman and the
 | ||||
| # Zsh Development Group have no obligation to provide maintenance,
 | ||||
| # support, updates, enhancements, or modifications.
 | ||||
| #
 | ||||
| 
 | ||||
| # fundamentals
 | ||||
| SHELL = /bin/sh | ||||
| @SET_MAKE@ | ||||
| 
 | ||||
| # source/build directories
 | ||||
| VPATH           = @srcdir@ | ||||
| sdir            = @srcdir@ | ||||
| sdir_top        = @top_srcdir@ | ||||
| 
 | ||||
| # installation directories
 | ||||
| prefix          = @prefix@ | ||||
| exec_prefix     = @exec_prefix@ | ||||
| bindir          = @bindir@ | ||||
| libdir          = @libdir@ | ||||
| MODDIR          = $(libdir)/zsh/$(VERSION) | ||||
| infodir         = @infodir@ | ||||
| mandir          = @mandir@ | ||||
| 
 | ||||
| # compilation
 | ||||
| CC              = @CC@ | ||||
| CPPFLAGS        = @CPPFLAGS@ | ||||
| DEFS            = @DEFS@ | ||||
| CFLAGS          = @CFLAGS@ | ||||
| LDFLAGS         = @LDFLAGS@ | ||||
| EXTRA_LDFLAGS   = @EXTRA_LDFLAGS@ | ||||
| DLCFLAGS        = @DLCFLAGS@ | ||||
| DLLDFLAGS       = @DLLDFLAGS@ | ||||
| LIBLDFLAGS      = @LIBLDFLAGS@ | ||||
| EXELDFLAGS      = @EXELDFLAGS@ | ||||
| LIBS            = @LIBS@ | ||||
| DL_EXT          = @DL_EXT@ | ||||
| DLLD            = @DLLD@ | ||||
| 
 | ||||
| # utilities
 | ||||
| AWK             = @AWK@ | ||||
| YODL            = @YODL@ | ||||
| YODL2TXT        = $(YODL)2txt | ||||
| YODL2HTML       = $(YODL)2html | ||||
| 
 | ||||
| # install utility
 | ||||
| INSTALL         = @INSTALL@ | ||||
| INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||||
| INSTALL_DATA    = @INSTALL_DATA@ | ||||
| 
 | ||||
| # flags passed to recursive makes in subdirectories
 | ||||
| MAKEDEFS = \
 | ||||
| prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
 | ||||
| libdir='$(libdir)' MODDIR='$(MODDIR)' infodir='$(infodir)' mandir='$(mandir)' \
 | ||||
| CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' CFLAGS='$(CFLAGS)' \
 | ||||
| LDFLAGS='$(LDFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
 | ||||
| DLCFLAGS='$(DLCFLAGS)' DLLDFLAGS='$(DLLDFLAGS)' \
 | ||||
| LIBLDFLAGS='$(LIBLDFLAGS)' EXELDFLAGS='$(EXELDFLAGS)' \
 | ||||
| LIBS='$(LIBS)' DL_EXT='$(DL_EXT)' DLLD='$(DLLD)' \
 | ||||
| AWK='$(AWK)' YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)' | ||||
| 
 | ||||
| # override built-in suffix list
 | ||||
| .SUFFIXES: | ||||
|  | @ -1 +0,0 @@ | |||
| (("/home/user2/pws/src/zsh-3.1.5/Doc/Zsh/expn.yo" . 33735)) | ||||
|  | @ -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  | ||||
| ' | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array unalias | ||||
| __aliases=(-a) | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array shift | ||||
| __arrays=(-A) | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array autoload | ||||
| __autoload=(-s '${^fpath}/*(N:t)') | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array bg | ||||
| __bg_jobs=(-z -P '%') | ||||
|  | @ -1,7 +0,0 @@ | |||
| #function bindkey | ||||
| 
 | ||||
| if [[ -mword 1 -*[DAN]* || -mcurrent -1 -*M ]]; then | ||||
|   complist -s '$(bindkey -l)' | ||||
| else | ||||
|   complist -b | ||||
| fi | ||||
|  | @ -1,7 +0,0 @@ | |||
| #function builtin | ||||
| 
 | ||||
| if [[ -position 2 -1 ]]; then | ||||
|   compsub | ||||
| else | ||||
|   complist -eB | ||||
| fi | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function cd | ||||
| 
 | ||||
| __files -W cdpath -g '*(-/)' | ||||
|  | @ -1,7 +0,0 @@ | |||
| #function command | ||||
| 
 | ||||
| if [[ -position 2 -1 ]]; then | ||||
|   compsub | ||||
| else | ||||
|   complist -em | ||||
| fi | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array --command-- | ||||
| __command_names=(-c) | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function compress | ||||
| 
 | ||||
| __files -g '*~*.Z' | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function rmdir df du dircmp | ||||
| 
 | ||||
| __files -/ '*(-/)' | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function xdvi dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype | ||||
| 
 | ||||
| __files -g '*.(dvi|DVI)' | ||||
|  | @ -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)') | ||||
|  | @ -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 | ||||
|  | @ -1,7 +0,0 @@ | |||
| #function fc | ||||
| 
 | ||||
| if [[ -mcurrent -1 -*e ]]; then | ||||
|   complist -c | ||||
| elif [[ -mcurrent -1 -[ARWI]## ]]; then | ||||
|   __files | ||||
| fi | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array unfunction | ||||
| __functions=(-F) | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function gunzip zcat | ||||
| 
 | ||||
| __files -g '*.[gG][z]' | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function gzip | ||||
| 
 | ||||
| __files -g '*~*.[gG][zZ]' | ||||
|  | @ -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 | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array ftp ncftp ping rwho rup xping traceroute nslookup | ||||
| __hosts=(-k hosts) | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array fg jobs | ||||
| __jobs=(-j -P '%') | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #helper | ||||
| 
 | ||||
| reply=( "$(ps 2>/dev/null)" ) | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array limit unlimit | ||||
| __limits=(-k "(${(j: :)${(f)$(limit)}%% *})") | ||||
|  | @ -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 | ||||
|  | @ -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" "$@" | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function make gmake pmake | ||||
| 
 | ||||
| complist -s "\$(awk '/^[a-zA-Z0-9][^/ 	]+:/ {print \$1}' FS=: [mM]akefile)" | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -1,2 +0,0 @@ | |||
| #key-array expand-or-complete \C-xm | ||||
| __most_recent_file=(-g '*(om[1])') | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| function acroread | ||||
| 
 | ||||
| __files -g '*.(pdf|PDF)' | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function  gs ghostview gview psnup psselect pswrap pstops pstruct lpr | ||||
| 
 | ||||
| __files -g '*([pP][sS]|eps)' | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function sched | ||||
| 
 | ||||
| [[ -position 2 -1 ]] && compsub | ||||
|  | @ -1,7 +0,0 @@ | |||
| #function  set | ||||
| 
 | ||||
| if [[ -mcurrent -1 [-+]o ]]; then | ||||
|   complist -o | ||||
| elif [[ -current -1 -A ]]; then | ||||
|   complist -A | ||||
| fi | ||||
|  | @ -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 | ||||
|  | @ -1,7 +0,0 @@ | |||
| #function source | ||||
| 
 | ||||
| if [[ -position 2 -1 ]]; then | ||||
|   compsub | ||||
| else | ||||
|   __files | ||||
| fi | ||||
|  | @ -1,2 +0,0 @@ | |||
| #function strip | ||||
| __files -g '*(*)' | ||||
|  | @ -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 | ||||
|  | @ -1,4 +0,0 @@ | |||
| #function --subscript-- | ||||
| 
 | ||||
| compalso --math-- "$@" | ||||
| [[ ${(Pt)${COMMAND}} = assoc* ]] && complist -k "( ${(kP)${COMMAND}} )" | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function tex latex slitex | ||||
| 
 | ||||
| __files -g '*.(tex|TEX|texinfo|texi)' | ||||
|  | @ -1,7 +0,0 @@ | |||
| #function trap | ||||
| 
 | ||||
| if [[ -position 1 ]]; then | ||||
|   complist -c | ||||
| else | ||||
|   complist -k signals | ||||
| fi | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function uncompress zmore | ||||
| 
 | ||||
| __files -g '*.Z' | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array --math-- getopts read unset vared | ||||
| __vars=(-v) | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array declare export integer local readonly typeset | ||||
| __varseq=(-v -q -S '=') | ||||
|  | @ -1,4 +0,0 @@ | |||
| #function wait | ||||
| 
 | ||||
| complist -P '%' -j | ||||
| complist -y __kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' | ||||
|  | @ -1,2 +0,0 @@ | |||
| #array which whence where type | ||||
| __which=(-caF) | ||||
|  | @ -1,5 +0,0 @@ | |||
| #pattern-function '*/X11/*' | ||||
| 
 | ||||
| # A simple pattern completion, just as an example. | ||||
| 
 | ||||
| complist -J options -k '(-display -name -xrm)' | ||||
|  | @ -1,3 +0,0 @@ | |||
| #function xfig | ||||
| 
 | ||||
| __files -g '*.fig' | ||||
|  | @ -1,7 +0,0 @@ | |||
| #function zle | ||||
| 
 | ||||
| if [[ -word 1 -N && -position 3 ]]; then | ||||
|   complist -F | ||||
| else | ||||
|   complist -b | ||||
| fi | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp unalias | ||||
| 
 | ||||
| complist -a | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp shift | ||||
| 
 | ||||
| complist -A | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp autoload | ||||
| 
 | ||||
| complist -s '${^fpath}/*(N:t)' | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp bg | ||||
| 
 | ||||
| complist -z -P '%' | ||||
|  | @ -1,7 +0,0 @@ | |||
| #defcomp bindkey | ||||
| 
 | ||||
| if [[ -mword 1 -*[DAN]* || -mcurrent -1 -*M ]]; then | ||||
|   complist -s '$(bindkey -l)' | ||||
| else | ||||
|   complist -b | ||||
| fi | ||||
|  | @ -1,7 +0,0 @@ | |||
| #defcomp builtin | ||||
| 
 | ||||
| if [[ -position 2 -1 ]]; then | ||||
|   compsub | ||||
| else | ||||
|   complist -eB | ||||
| fi | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp cd | ||||
| 
 | ||||
| _files -W cdpath -g '*(-/)' | ||||
|  | @ -1,7 +0,0 @@ | |||
| #defcomp command | ||||
| 
 | ||||
| if [[ -position 2 -1 ]]; then | ||||
|   _normal "$@" | ||||
| else | ||||
|   complist -em | ||||
| fi | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp -command- | ||||
| 
 | ||||
| complist -c | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp compress | ||||
| 
 | ||||
| _files -g '*~*.Z' | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp rmdir df du dircmp | ||||
| 
 | ||||
| _files -/ '*(-/)' | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp xdvi dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype | ||||
| 
 | ||||
| _files -g '*.(dvi|DVI)' | ||||
|  | @ -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)' | ||||
|  | @ -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 | ||||
|  | @ -1,7 +0,0 @@ | |||
| #defcomp fc | ||||
| 
 | ||||
| if [[ -mcurrent -1 -*e ]]; then | ||||
|   complist -c | ||||
| elif [[ -mcurrent -1 -[ARWI]## ]]; then | ||||
|   _files | ||||
| fi | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp unfunction | ||||
| 
 | ||||
| complist -F | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp gunzip zcat | ||||
| 
 | ||||
| _files -g '*.[gG][z]' | ||||
|  | @ -1,3 +0,0 @@ | |||
| #defcomp gzip | ||||
| 
 | ||||
| _files -g '*~*.[gG][zZ]' | ||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue