aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2011-09-17 08:25:44 +0200
committerMathias Bynens <mathias@qiwi.be>2011-09-17 08:25:44 +0200
commit730c7f7084b0b09c18c018132abb90ec56c45579 (patch)
treec112ed0e64eee22f0ddb3b132a4fb61e22026d7e
parent48bac9e2640d99801564adc7d1a44ac7a4934a04 (diff)
downloaddotfiles-730c7f7084b0b09c18c018132abb90ec56c45579.tar.gz
dotfiles-730c7f7084b0b09c18c018132abb90ec56c45579.tar.bz2
dotfiles-730c7f7084b0b09c18c018132abb90ec56c45579.zip
Better tab completion for SSH hostnames based on ~/.ssh/config.
-rwxr-xr-x.bash_profile5
1 files changed, 2 insertions, 3 deletions
diff --git a/.bash_profile b/.bash_profile
index 0b9282e..22b21ae 100755
--- a/.bash_profile
+++ b/.bash_profile
@@ -8,6 +8,5 @@ done
# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob
-# auto complete ssh host names (the crap between ` and ` just has to be a list... you could just make a list of hosts....
-complete -W "$(echo `grep ^Host ~/.ssh/config |sed -e 's/Host //g'| grep -v "*"`;)" ssh
-
+# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
+complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh \ No newline at end of file