Use __fish_complete_user_at_hosts

for various completions.

This makes the code a bit nicer, removes one of the
__fish_print_hostnames calls (which are slow) and a sed call, thereby
improving performance by about 33% (600ms to 400ms).

Fixes #4511.
This commit is contained in:
Fabian Homborg
2017-11-08 12:52:16 +01:00
parent 45fc499a91
commit 60248e895f
4 changed files with 4 additions and 37 deletions

View File

@@ -6,14 +6,7 @@ __fish_complete_ssh ssh
#
# ssh specific completions
#
complete -x -c ssh -d Hostname -a "
(__fish_print_hostnames)
(
# Prepend any username specified in the completion to the hostname
echo (commandline -ct)|sed -ne 's/\(.*@\).*/\1/p'
)(__fish_print_hostnames)
"
complete -x -c ssh -d Hostname -a "(__fish_complete_user_at_hosts)"
# Disable as username completion is not very useful.
# complete -x -c ssh -d User -a "