aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Bay <github@tixz.dk>2014-10-18 20:37:10 +0200
committerMathias Bynens <mathias@qiwi.be>2014-10-30 11:05:14 +0100
commitfecb8c6115f5ca3d1ff4656dd8a07274945ed797 (patch)
tree58fd8181026357ff0e23640481638ef968de1471
parent91be10dcee350465566a48cbe303686d2d989d6d (diff)
downloaddotfiles-fecb8c6115f5ca3d1ff4656dd8a07274945ed797.tar.gz
dotfiles-fecb8c6115f5ca3d1ff4656dd8a07274945ed797.tar.bz2
dotfiles-fecb8c6115f5ca3d1ff4656dd8a07274945ed797.zip
.bash_profile: Support multiple hosts in SSH completion
Useful in cases such as: ``` Host vm1 vm2 vm3 vm4 Host localhost # ... ``` Simply adding a `-` to `tr` fixes this. Closes #437.
-rw-r--r--.bash_profile2
1 files changed, 1 insertions, 1 deletions
diff --git a/.bash_profile b/.bash_profile
index 3f824a0..daa7552 100644
--- a/.bash_profile
+++ b/.bash_profile
@@ -38,7 +38,7 @@ if type _git &> /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completio
fi;
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
-[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh;
+[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh;
# Add tab completion for `defaults read|write NSGlobalDomain`
# You could just use `-g` instead, but I like being explicit