@@ -4,8 +4,8 @@ export PATH="$HOME/bin:$PATH";
4
4
# Load the shell dotfiles, and then some:
5
5
# * ~/.path can be used to extend `$PATH`.
6
6
# * ~/.extra can be used for other settings you don’t want to commit.
7
- for file in ~ /.{path,bash_prompt,exports,aliases,functions,grc.bashrc, extra}; do
8
- [ -r " $file " ] && [ -f " $file " ] && source " $file " ;
7
+ for file in ~ /.{path,bash_prompt,exports,aliases,functions,extra}; do
8
+ [ -r " $file " ] && [ -f " $file " ] && source " $file " ;
9
9
done ;
10
10
unset file;
11
11
@@ -22,19 +22,12 @@ shopt -s cdspell;
22
22
# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
23
23
# * Recursive globbing, e.g. `echo **/*.txt`
24
24
for option in autocd globstar; do
25
- shopt -s " $option " 2> /dev/null;
25
+ shopt -s " $option " 2> /dev/null;
26
26
done ;
27
27
28
- # Add tab completion for many Bash commands
29
- if which brew > /dev/null && [ -f " $( brew --prefix) /etc/bash_completion" ]; then
30
- source " $( brew --prefix) /etc/bash_completion" ;
31
- elif [ -f /etc/bash_completion ]; then
32
- source /etc/bash_completion;
33
- fi ;
34
-
35
28
# Enable tab completion for `g` by marking it as an alias for `git`
36
29
if type _git & > /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
37
- complete -o default -o nospace -F _git g;
30
+ complete -o default -o nospace -F _git g;
38
31
fi ;
39
32
40
33
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
@@ -49,19 +42,38 @@ complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes Syste
49
42
50
43
# If possible, add tab completion for many more commands
51
44
if [ -f /etc/bash_completion ]; then
52
- source /etc/bash_completion
45
+ source /etc/bash_completion
53
46
fi
54
47
55
48
# Enable Shell integration for iTerm2
56
49
# http://iterm2.com/shell_integration.html
57
50
source ~ /.iterm2_shell_integration.bash
58
51
59
- if [ -n " ` which brew` " ] && [ -f " $HOME /.brew.bashrc" ]
60
- then
61
- source $HOME /.brew.bashrc
52
+ if [ command -v brew ]; then
53
+ # Add bash completion for brew installed formuale
54
+ if [ -f $( brew --prefix) /etc/bash_completion ]; then
55
+ source $( brew --prefix) /etc/bash_completion
56
+ elif [ -f /etc/bash_completion ]; then
57
+ source /etc/bash_completion;
58
+ fi
59
+
60
+ # Add completion for `brew` itself.
61
+ source ` brew --repository` /Library/Contributions/brew_bash_completion.sh
62
+
63
+ # Brew & Cask aliases
64
+ alias b=" brew"
65
+ alias cask=" brew cask"
66
+
67
+ # Enable brew command autocompletion for `b` alias as well
68
+ complete -o default -F _brew b
69
+
70
+ # Enable vagrant command autocompletion for `vg` alias as well
71
+ complete -o default -F _vagrant vg
72
+ elif [ -f /etc/bash_completion ]; then
73
+ source /etc/bash_completion;
62
74
fi
63
75
64
76
# Add `rbenv init` to the shell to enable shims and autocompletion
65
- if which rbenv > /dev/null; then
77
+ if command -v rbenv > /dev/null; then
66
78
eval " $( rbenv init -) "
67
79
fi ;
0 commit comments