Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to accept a completion?



On Apr 29,  8:36pm, Mikael Magnusson wrote:
}
} Okay, finally encountered a real example of this being annoying now.
} % scp file lt<tab>
} ---- file
} lth/
} ---- remote host name
} lth
} 
} tabbing to the remote host name gives me
} % scp file lth:
} Now how do i complete files on the remote end? If i press tab again i just get
} % scp file lth/
} And if i type a : i get
} % scp file lth::

This is a bug in the _ssh completer that's used for scp et al., not in
the way completion is supposed to work.  You should be able to type a
colon at that point to interrupt the completion cycle to go on to the
next completion.

I believe the following is the correct fix.  I tried some more specific
things with -r instead of -q but they seemed unsatisfactory.  (I'm not
sure why $suf needs to be an array at line 293?)


Index: Completion/Unix/Command/_ssh
===================================================================
retrieving revision 1.19
diff -c -r1.19 _ssh
--- _ssh	4 Nov 2008 04:47:52 -0000	1.19
+++ _ssh	29 Apr 2009 23:59:54 -0000
@@ -227,7 +227,7 @@
         esac
       else
         _wanted values expl 'configure file option' \
-            compadd -M 'm:{a-z}={A-Z}' -S '=' - \
+            compadd -M 'm:{a-z}={A-Z}' -qS '=' - \
 	    	AddressFamily \
                 AFSTokenPassing BatchMode BindAddress \
 		ChallengeResponseAuthentication CheckHostIP \
@@ -293,12 +293,12 @@
         _remote_files ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0
       elif compset -P '*@'; then
         suf=( -S '' )
-        compset -S ':*' || suf=( -S : )
+        compset -S ':*' || suf=( -qS : )
         _wanted hosts expl 'remote host name' _ssh_hosts $suf && ret=0
       else
         _alternative \
 	    'files:: _files' \
-	    'hosts:remote host name:_ssh_hosts -S:' \
+	    'hosts:remote host name:_ssh_hosts -qS:' \
 	    'users:user:_ssh_users -qS@' && ret=0
       fi
       ;;
@@ -306,10 +306,10 @@
       if compset -P '*:'; then
         _remote_files && ret=0
       elif compset -P '*@'; then
-        _wanted hosts expl host _ssh_hosts -S: && ret=0
+        _wanted hosts expl host _ssh_hosts -qS: && ret=0
       else
         _alternative \
-	    'hosts:remote host name:_ssh_hosts -S:' \
+	    'hosts:remote host name:_ssh_hosts -qS:' \
 	    'users:user:_ssh_users -qS@' && ret=0
       fi
       ;;



Messages sorted by: Reverse Date, Date, Thread, Author