Lets say, I have one file in current directory, test.txt
and I want to transfer it using scp
to remote server.
When I use completion, ie:
scp -rp test<TAB>
instead of completing the rest of the filename for me, zsh completion offers:
scp -rp test<TAB>
test.txt
testuser
testuser
happens to be local user on my system. Why would zsh completion complete local user, when I am connecting to remote server ?
That seems like a useless and stupid rule.
scp
is using same completion file as ssh /usr/share/zsh/functions/Completion/Unix/_ssh
, and ssh
command has the same behavior, although in case of ssh
it is less annoying, since ssh is not supposed to complete local filenames.
How can I modify the completion rules for scp
so that it only offers local filenames, not local users?
UPDATE FOR BOUNTY
The accepted solution works for scp
, but the problem still persist for ssh
. When I want to connect to myserver.domain.org
and use completion:
ssh m<TAB>
the completion system offers myserver.domain.org
(which is desired), but also local users man
and messagebus
, which is idiotic.
How can I change the completion system for ssh/scp
so that instead of completing all local users from /etc/passwd
, I can specify (hardcoded) list of users that I want to complete?
So, in other words:
I don't want to disable user completion for ssh
, as the accepted answer does for scp
. But I want to provide my own list of users that will be completed, instead using all local users from /etc/passwd