summary refs log tree commit diff
path: root/Completion/Unix/Type/_cmdambivalent
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Type/_cmdambivalent')
-rw-r--r--Completion/Unix/Type/_cmdambivalent17
1 files changed, 17 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_cmdambivalent b/Completion/Unix/Type/_cmdambivalent
new file mode 100644
index 000000000..1f15d11ab
--- /dev/null
+++ b/Completion/Unix/Type/_cmdambivalent
@@ -0,0 +1,17 @@
+#autoload
+
+if (( CURRENT == 1 && ${#words} == 1 )); then
+  # Heuristics to decide whether to complete for system() or for execl().
+  local space=' '
+  if (( ${${words[CURRENT]}[(I)$space]} )); then
+    _cmdstring
+  elif [[ ${${compstate[all_quotes]}[1]} == (\'|\") ]]; then
+    _cmdstring
+  else
+    _command_names -e
+  fi
+elif (( CURRENT == 1 )); then
+  _command_names -e
+else
+  _normal
+fi