about summary refs log tree commit diff
path: root/Completion/Zsh/Context/_redirect
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Zsh/Context/_redirect')
-rw-r--r--Completion/Zsh/Context/_redirect16
1 files changed, 15 insertions, 1 deletions
diff --git a/Completion/Zsh/Context/_redirect b/Completion/Zsh/Context/_redirect
index 6e02636da..5e454014b 100644
--- a/Completion/Zsh/Context/_redirect
+++ b/Completion/Zsh/Context/_redirect
@@ -1,3 +1,17 @@
 #compdef -redirect-
 
-_files
+# This searches for `<command-name>:<redir-op>' and `<redir-op>', where
+# `<redir-op>' is something like `<' or `2>'.
+
+local strs _comp_command1 _comp_command2
+
+_set_command
+
+strs=( "$compstate[redirect]" )
+
+if [[ -n "$_comp_command1" ]]; then
+  strs=( "${_comp_command1}:$strs[-1]" "$strs[@]" )
+  [[ -n "$_comp_command2" ]] && strs=( "${_comp_command2}:$strs[1]" "$strs[@]" )
+fi
+
+_dispatch -d redirs "$strs[@]"