about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Builtins/_compdef22
-rw-r--r--Completion/User/_dirs3
2 files changed, 25 insertions, 0 deletions
diff --git a/Completion/Builtins/_compdef b/Completion/Builtins/_compdef
new file mode 100644
index 000000000..1df5758b3
--- /dev/null
+++ b/Completion/Builtins/_compdef
@@ -0,0 +1,22 @@
+#compdef compdef
+
+local func base=2
+
+while [[ $words[base] = -* ]]; do
+  case $words[base] in
+    -d) delete=yes ;;
+    -p) type=pattern ;;
+    -k) type=key ;;
+  esac  
+  (( base++ ))
+done
+
+if [ "$delete" ]; then
+  compadd ${(k)_comps}
+else
+  if [[ CURRENT -eq base  ]]; then
+    for func in ${^~fpath:/.}/_(|*[^~])(N:t); compadd -P_ - ${func#_}
+  else
+    compgen -c
+  fi
+fi
diff --git a/Completion/User/_dirs b/Completion/User/_dirs
new file mode 100644
index 000000000..04c4b75d9
--- /dev/null
+++ b/Completion/User/_dirs
@@ -0,0 +1,3 @@
+#compdef rmdir df du dircmp
+
+_files -/