Skip to content

Commit

Permalink
bash_profile: Support multiple hosts in SSH completion mathiasbynens/…
Browse files Browse the repository at this point in the history
…dotfiles@fecb8c6

also move rupa/z code to the bottom of the file to keep with my other code
  • Loading branch information
s10wen committed Dec 29, 2014
1 parent f1401be commit 439784a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .bash_profile
Expand Up @@ -9,9 +9,6 @@ for file in ~/.{path,bash_prompt,exports,aliases,functions,extra}; do
done;
unset file;

# init z https://github.com/rupa/z
. ~/z/z.sh

# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob;

Expand Down Expand Up @@ -41,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
Expand All @@ -50,6 +47,9 @@ complete -W "NSGlobalDomain" defaults;
# Add `killall` tab completion for common apps
complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal Twitter" killall;

# init z https://github.com/rupa/z
. ~/z/z.sh

# Thanks to @tmoitie, adds more tab completion for bash,
# also when hitting tab twice it will show a list.
if [ -f $(brew --prefix)/etc/bash_completion ]; then
Expand Down

0 comments on commit 439784a

Please sign in to comment.