summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_tmux2
-rw-r--r--Completion/Unix/Type/_cmdambivalent17
2 files changed, 18 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 0917da604..5f5bea922 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -526,7 +526,7 @@ _tmux-new-session() {
     '-t+[specify target session]:session:__tmux-sessions' \
     '-x[specify width]:width' \
     '-y[specify height]:height' \
-    '*:: :_cmdstring'
+    '*:: :_cmdambivalent'
 }
 
 _tmux-new-window() {
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