Skip to content

Instantly share code, notes, and snippets.

@patorash
Created December 24, 2015 01:00
Show Gist options
  • Save patorash/377268ef75f012318279 to your computer and use it in GitHub Desktop.
Save patorash/377268ef75f012318279 to your computer and use it in GitHub Desktop.
fishにて、pecoを使って~/.ssh/configの情報を元にsshの接続先を選択可能にしたやつ
function peco_ssh
awk '
tolower($1)=="host" {
for(i=2;i<=NF; i++) {
if ($i !~ "[*?]") {
print $i
}
}
}
' ~/.ssh/config | sort | peco | read -l hostname
if test -n "$hostname"
ssh $hostname
end
end
alias s "peco_ssh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment