about summary refs log tree commit diff
path: root/Completion/User/_ssh
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_ssh')
-rw-r--r--Completion/User/_ssh12
1 files changed, 8 insertions, 4 deletions
diff --git a/Completion/User/_ssh b/Completion/User/_ssh
index c6a6898f1..7e81123ef 100644
--- a/Completion/User/_ssh
+++ b/Completion/User/_ssh
@@ -1,9 +1,12 @@
-#compdef ssh slogin scp ssh-add ssh-agent ssh-keygen
+#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen
 
 _remote_files () {
   # This is extremely simple-minded; could parse "ls -F" output to do
   # colorings and LIST_TYPES and so on, but I'm just not that ambitious.
-  compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
+  local expl
+
+  _wanted files expl 'remote files' \
+      compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
 }
 
 _ssh () {
@@ -14,8 +17,8 @@ _ssh () {
 
   # ssh-opt is a pseudo-command used to complete ssh options for `scp -o'.
 
-  case "${words[1]:t}" in
-  ssh|slogin)
+  case "$service" in
+  ssh)
     args=(
       ':remote host name:->userhost'
       '(-):command: _command_names -e'
@@ -179,6 +182,7 @@ _ssh () {
       compset -q
       words=(ssh-opt "$words[@]" )
       (( CURRENT++ ))
+      service=ssh-opt
       _ssh
       return
     elif [[ -n "$state" ]]; then