Fish's current hostname completion uses ~/.ssh/known_hosts as one of its
sources of information, but ~/.ssh/config may also be useful.  Gather
all of the 'Host' declarations from ~/.ssh/config and filter out the
ones with wildcards.

Signed-off-by: James Vega <[email protected]>

---
 share/functions/__fish_print_hostnames.fish |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/share/functions/__fish_print_hostnames.fish 
b/share/functions/__fish_print_hostnames.fish
index 69e41e0..52efc73 100644
--- a/share/functions/__fish_print_hostnames.fish
+++ b/share/functions/__fish_print_hostnames.fish
@@ -12,5 +12,10 @@ function __fish_print_hostnames -d "Print a list of known 
hostnames"
 
        # Print hosts with known ssh keys
        cat ~/.ssh/known_hosts{,2} ^/dev/null|cut -d ' ' -f 1| cut -d , -f 1
+
+       # Print hosts from ssh configuration file
+       if [ -e ~/.ssh/config ]
+               grep '^ *Host' ~/.ssh/config | grep -v '[*?]' | cut -d ' ' -f 2
+       end
 end
 
-- 
tg: (c1b2e60..) features/ssh-host-completion (depends on: upstream)

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to