about summary refs log tree commit diff
path: root/Completion/Builtins
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:17:36 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:17:36 +0000
commit904b939cbd81a542303da2c58288b95b153106f5 (patch)
tree84b3751ed1deacc51eb186023101360ae92ef221 /Completion/Builtins
parentb4a5b9db8b528f9c9b6a9cbb00db381c95659380 (diff)
downloadzsh-3.1.5-pws-10.tar.gz
zsh-3.1.5-pws-10.tar.xz
zsh-3.1.5-pws-10.zip
zsh-3.1.5-pws-10 zsh-3.1.5-pws-10
Diffstat (limited to 'Completion/Builtins')
-rw-r--r--Completion/Builtins/_aliases3
-rw-r--r--Completion/Builtins/_arrays3
-rw-r--r--Completion/Builtins/_autoload3
-rw-r--r--Completion/Builtins/_bg_jobs3
-rw-r--r--Completion/Builtins/_bindkey7
-rw-r--r--Completion/Builtins/_builtin7
-rw-r--r--Completion/Builtins/_cd3
-rw-r--r--Completion/Builtins/_command7
-rw-r--r--Completion/Builtins/_dirs3
-rw-r--r--Completion/Builtins/_disable6
-rw-r--r--Completion/Builtins/_echotc3
-rw-r--r--Completion/Builtins/_enable6
-rw-r--r--Completion/Builtins/_fc7
-rw-r--r--Completion/Builtins/_functions3
-rw-r--r--Completion/Builtins/_hash13
-rw-r--r--Completion/Builtins/_jobs3
-rw-r--r--Completion/Builtins/_kill11
-rw-r--r--Completion/Builtins/_limits3
-rw-r--r--Completion/Builtins/_sched3
-rw-r--r--Completion/Builtins/_set7
-rw-r--r--Completion/Builtins/_setopt7
-rw-r--r--Completion/Builtins/_source7
-rw-r--r--Completion/Builtins/_trap7
-rw-r--r--Completion/Builtins/_unhash6
-rw-r--r--Completion/Builtins/_unsetopt7
-rw-r--r--Completion/Builtins/_vars_eq3
-rw-r--r--Completion/Builtins/_wait7
-rw-r--r--Completion/Builtins/_which3
-rw-r--r--Completion/Builtins/_zftp50
-rw-r--r--Completion/Builtins/_zle7
-rw-r--r--Completion/Builtins/_zmodload9
31 files changed, 217 insertions, 0 deletions
diff --git a/Completion/Builtins/_aliases b/Completion/Builtins/_aliases
new file mode 100644
index 000000000..1038a726e
--- /dev/null
+++ b/Completion/Builtins/_aliases
@@ -0,0 +1,3 @@
+#defcomp unalias
+
+complist -a
diff --git a/Completion/Builtins/_arrays b/Completion/Builtins/_arrays
new file mode 100644
index 000000000..cbeac7118
--- /dev/null
+++ b/Completion/Builtins/_arrays
@@ -0,0 +1,3 @@
+#defcomp shift
+
+complist -A
diff --git a/Completion/Builtins/_autoload b/Completion/Builtins/_autoload
new file mode 100644
index 000000000..4f506baeb
--- /dev/null
+++ b/Completion/Builtins/_autoload
@@ -0,0 +1,3 @@
+#defcomp autoload
+
+complist -s '${^fpath}/*(N:t)'
diff --git a/Completion/Builtins/_bg_jobs b/Completion/Builtins/_bg_jobs
new file mode 100644
index 000000000..511bb8308
--- /dev/null
+++ b/Completion/Builtins/_bg_jobs
@@ -0,0 +1,3 @@
+#defcomp bg
+
+complist -z -P '%'
diff --git a/Completion/Builtins/_bindkey b/Completion/Builtins/_bindkey
new file mode 100644
index 000000000..8eddeb2a8
--- /dev/null
+++ b/Completion/Builtins/_bindkey
@@ -0,0 +1,7 @@
+#defcomp bindkey
+
+if [[ -mword 1 -*[DAN]* || -mcurrent -1 -*M ]]; then
+  complist -s '$(bindkey -l)'
+else
+  complist -b
+fi
diff --git a/Completion/Builtins/_builtin b/Completion/Builtins/_builtin
new file mode 100644
index 000000000..a967932ee
--- /dev/null
+++ b/Completion/Builtins/_builtin
@@ -0,0 +1,7 @@
+#defcomp builtin
+
+if [[ -position 2 -1 ]]; then
+  _normal "$@"
+else
+  complist -eB
+fi
diff --git a/Completion/Builtins/_cd b/Completion/Builtins/_cd
new file mode 100644
index 000000000..f3ce67ec7
--- /dev/null
+++ b/Completion/Builtins/_cd
@@ -0,0 +1,3 @@
+#defcomp cd
+
+_files -W cdpath -g '*(-/)'
diff --git a/Completion/Builtins/_command b/Completion/Builtins/_command
new file mode 100644
index 000000000..b2812de25
--- /dev/null
+++ b/Completion/Builtins/_command
@@ -0,0 +1,7 @@
+#defcomp command
+
+if [[ -position 2 -1 ]]; then
+  _normal "$@"
+else
+  complist -em
+fi
diff --git a/Completion/Builtins/_dirs b/Completion/Builtins/_dirs
new file mode 100644
index 000000000..bc426e322
--- /dev/null
+++ b/Completion/Builtins/_dirs
@@ -0,0 +1,3 @@
+#defcomp rmdir df du dircmp
+
+_files -/
diff --git a/Completion/Builtins/_disable b/Completion/Builtins/_disable
new file mode 100644
index 000000000..063b65a7d
--- /dev/null
+++ b/Completion/Builtins/_disable
@@ -0,0 +1,6 @@
+#defcomp disable
+
+[[ -mcurrent -1 -*a* ]] && complist -ea
+[[ -mcurrent -1 -*f* ]] && complist -eF
+[[ -mcurrent -1 -*r* ]] && complist -ew
+[[ ! -mcurrent -1 -* ]] && complist -eB
diff --git a/Completion/Builtins/_echotc b/Completion/Builtins/_echotc
new file mode 100644
index 000000000..85ebb97ce
--- /dev/null
+++ b/Completion/Builtins/_echotc
@@ -0,0 +1,3 @@
+#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/Completion/Builtins/_enable b/Completion/Builtins/_enable
new file mode 100644
index 000000000..22ff53ee7
--- /dev/null
+++ b/Completion/Builtins/_enable
@@ -0,0 +1,6 @@
+#defcomp enable
+
+[[ -mcurrent -1 -*a* ]] && complist -da
+[[ -mcurrent -1 -*f* ]] && complist -dF
+[[ -mcurrent -1 -*r* ]] && complist -dw
+[[ ! -mcurrent -1 -* ]] && complist -dB
diff --git a/Completion/Builtins/_fc b/Completion/Builtins/_fc
new file mode 100644
index 000000000..f0d2c03fd
--- /dev/null
+++ b/Completion/Builtins/_fc
@@ -0,0 +1,7 @@
+#defcomp fc
+
+if [[ -mcurrent -1 -*e ]]; then
+  complist -c
+elif [[ -mcurrent -1 -[ARWI]## ]]; then
+  _files
+fi
diff --git a/Completion/Builtins/_functions b/Completion/Builtins/_functions
new file mode 100644
index 000000000..8a352ea08
--- /dev/null
+++ b/Completion/Builtins/_functions
@@ -0,0 +1,3 @@
+#defcomp unfunction
+
+complist -F
diff --git a/Completion/Builtins/_hash b/Completion/Builtins/_hash
new file mode 100644
index 000000000..171c5e2e8
--- /dev/null
+++ b/Completion/Builtins/_hash
@@ -0,0 +1,13 @@
+#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/Completion/Builtins/_jobs b/Completion/Builtins/_jobs
new file mode 100644
index 000000000..018883c61
--- /dev/null
+++ b/Completion/Builtins/_jobs
@@ -0,0 +1,3 @@
+#defcomp fg jobs
+
+complist -j -P '%'
diff --git a/Completion/Builtins/_kill b/Completion/Builtins/_kill
new file mode 100644
index 000000000..50796d36f
--- /dev/null
+++ b/Completion/Builtins/_kill
@@ -0,0 +1,11 @@
+#defcomp kill
+
+local list
+
+if [[ -iprefix '-' ]]; then
+  complist -k "($signals[1,-3])"
+else
+  complist -P '%' -j
+  list=("$(ps 2>/dev/null)")
+  complist -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`'
+fi
diff --git a/Completion/Builtins/_limits b/Completion/Builtins/_limits
new file mode 100644
index 000000000..35ccbe07e
--- /dev/null
+++ b/Completion/Builtins/_limits
@@ -0,0 +1,3 @@
+#defcomp limit unlimit
+
+complist -k "(${(j: :)${(f)$(limit)}%% *})"
diff --git a/Completion/Builtins/_sched b/Completion/Builtins/_sched
new file mode 100644
index 000000000..1e8ae3445
--- /dev/null
+++ b/Completion/Builtins/_sched
@@ -0,0 +1,3 @@
+#defcomp sched
+
+[[ -position 2 -1 ]] && _normal "$@"
diff --git a/Completion/Builtins/_set b/Completion/Builtins/_set
new file mode 100644
index 000000000..5597025bc
--- /dev/null
+++ b/Completion/Builtins/_set
@@ -0,0 +1,7 @@
+#defcomp set
+
+if [[ -mcurrent -1 [-+]o ]]; then
+  complist -o
+elif [[ -current -1 -A ]]; then
+  complist -A
+fi
diff --git a/Completion/Builtins/_setopt b/Completion/Builtins/_setopt
new file mode 100644
index 000000000..4abb3ccee
--- /dev/null
+++ b/Completion/Builtins/_setopt
@@ -0,0 +1,7 @@
+#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/Completion/Builtins/_source b/Completion/Builtins/_source
new file mode 100644
index 000000000..aae2c7320
--- /dev/null
+++ b/Completion/Builtins/_source
@@ -0,0 +1,7 @@
+#defcomp source
+
+if [[ -position 2 -1 ]]; then
+  _normal "$@"
+else
+  _files
+fi
diff --git a/Completion/Builtins/_trap b/Completion/Builtins/_trap
new file mode 100644
index 000000000..59e81c589
--- /dev/null
+++ b/Completion/Builtins/_trap
@@ -0,0 +1,7 @@
+#defcomp trap
+
+if [[ -position 1 ]]; then
+  complist -c
+else
+  complist -k signals
+fi
diff --git a/Completion/Builtins/_unhash b/Completion/Builtins/_unhash
new file mode 100644
index 000000000..fe40c25a2
--- /dev/null
+++ b/Completion/Builtins/_unhash
@@ -0,0 +1,6 @@
+#defcomp unhash
+
+[[ -mword 1 -*d* ]] && complist -n
+[[ -mword 1 -*a* ]] && complist -a
+[[ -mword 1 -*f* ]] && complist -F
+[[ ! -mword 1 -* ]] && complist -m
diff --git a/Completion/Builtins/_unsetopt b/Completion/Builtins/_unsetopt
new file mode 100644
index 000000000..90d642b51
--- /dev/null
+++ b/Completion/Builtins/_unsetopt
@@ -0,0 +1,7 @@
+#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/Completion/Builtins/_vars_eq b/Completion/Builtins/_vars_eq
new file mode 100644
index 000000000..fcbb0148c
--- /dev/null
+++ b/Completion/Builtins/_vars_eq
@@ -0,0 +1,3 @@
+#defcomp declare export integer local readonly typeset
+
+complist -v -q -S '='
diff --git a/Completion/Builtins/_wait b/Completion/Builtins/_wait
new file mode 100644
index 000000000..29a7f6002
--- /dev/null
+++ b/Completion/Builtins/_wait
@@ -0,0 +1,7 @@
+#defcomp wait
+
+local list
+
+complist -P '%' -j
+list=("$(ps 2>/dev/null)")
+complist -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`'
diff --git a/Completion/Builtins/_which b/Completion/Builtins/_which
new file mode 100644
index 000000000..324256e3d
--- /dev/null
+++ b/Completion/Builtins/_which
@@ -0,0 +1,3 @@
+#defcomp which whence where type
+
+complist -caF
diff --git a/Completion/Builtins/_zftp b/Completion/Builtins/_zftp
new file mode 100644
index 000000000..9be9c94db
--- /dev/null
+++ b/Completion/Builtins/_zftp
@@ -0,0 +1,50 @@
+#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/Completion/Builtins/_zle b/Completion/Builtins/_zle
new file mode 100644
index 000000000..bb1102e74
--- /dev/null
+++ b/Completion/Builtins/_zle
@@ -0,0 +1,7 @@
+#defcomp zle
+
+if [[ -word 1 -N && -position 3 ]]; then
+  complist -F
+else
+  complist -b
+fi
diff --git a/Completion/Builtins/_zmodload b/Completion/Builtins/_zmodload
new file mode 100644
index 000000000..112acb57c
--- /dev/null
+++ b/Completion/Builtins/_zmodload
@@ -0,0 +1,9 @@
+#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