This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##autocomplete ssh | |
#Thanks to: https://gist.github.com/magnetikonline/bcd4186e14ed02145390 | |
function _completeSSHHosts { | |
COMPREPLY=() | |
local currentWord=${COMP_WORDS[COMP_CWORD]} | |
local completeHosts=$( | |
cat "$HOME/.ssh/config" | \ | |
grep --extended-regexp --regexp "^(Host|host) +[^* ]+? *$" | \ |