From a4c03e3d7b7c6b50616ed4b62875b529dbcfb411 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 5 Sep 2017 16:27:16 +0200 Subject: [PATCH] ssh completions: Don't call __fish_print_hostnames twice Saves about 40% of the time in this completion. --- share/completions/ssh.fish | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/share/completions/ssh.fish b/share/completions/ssh.fish index f9f4dc328..65c6c164c 100644 --- a/share/completions/ssh.fish +++ b/share/completions/ssh.fish @@ -7,11 +7,10 @@ __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' +# First print an empty line to get just the hostname +(echo; +# Then prepend any username specified in the completion to the hostname +commandline -ct | string replace -rf '(.*@).*' '$1' )(__fish_print_hostnames) "