-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.zsh
executable file
·196 lines (160 loc) · 4.97 KB
/
bootstrap.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/usr/bin/env zsh
set -e
set -u
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
NVM_DIR=${NVM_DIR:-$XDG_DATA_HOME/nvm}
PYENV_ROOT=${PYENV_ROOT:-$XDG_DATA_HOME/pyenv}
RBENV_ROOT=${RBENV_ROOT:-$XDG_DATA_HOME/rbenv}
function puts () {
echo "\n-- [$1] $2"
}
if ! [[ -d $XDG_DATA_HOME ]]; then
mkdir -p $XDG_DATA_HOME
fi
if ! [[ -d $HOME/.cache/ssh/sockets ]]; then
mkdir -p $HOME/.cache/ssh/sockets
puts 'Created' '~/.cache/ssh/sockets'
fi
if ! [[ -e $HOME/.config/zsh/env.zsh ]]; then
mkdir -p $HOME/.config/zsh
touch $HOME/.config/zsh/env.zsh
puts 'Created' '~/.config/zsh/env.zsh'
fi
if ! [[ -e $HOME/.gemrc ]]; then
echo 'gem: --no-document' > $HOME/.gemrc
puts 'Created' '~/.gemrc'
fi
if ! [[ -d $HOME/.config/zplug ]]; then
puts 'Installing' 'zshrc'
cp dotfiles/zshenv $HOME/.zshenv
curl -L https://rc.evansosenko.com/zshrc/install.sh | sh
fi
if ! [[ -d $HOME/.config/zplug ]]; then
puts 'Installed' 'zshrc'
fi
if ! [[ -d $RBENV_ROOT ]]; then
puts 'Installing' 'rbenv'
git clone https://github.com/sstephenson/rbenv.git $RBENV_ROOT
cp -p config/rbenv/default-gems $RBENV_ROOT
cd $RBENV_ROOT
git checkout $(git describe --abbrev=0 --tags)
src/configure
make -C src
fi
if [[ -d $RBENV_ROOT ]]; then
puts 'Installed' 'rbenv'
fi
if ! [[ -d $RBENV_ROOT/plugins/ruby-build ]]; then
puts 'Installing' 'ruby-build'
git clone https://github.com/sstephenson/ruby-build.git \
$RBENV_ROOT/plugins/ruby-build
cd $RBENV_ROOT/plugins/ruby-build
git checkout $(git describe --abbrev=0 --tags)
fi
if [[ -d $RBENV_ROOT/plugins/ruby-build ]]; then
puts 'Installed' 'ruby-build'
fi
if ! [[ -d $RBENV_ROOT/plugins/rbenv-gem-rehash ]]; then
puts 'Installing' 'rbenv-gem-rehash'
git clone https://github.com/sstephenson/rbenv-gem-rehash.git \
$RBENV_ROOT/plugins/rbenv-gem-rehash
fi
if [[ -d $RBENV_ROOT/plugins/rbenv-gem-rehash ]]; then
puts 'Installed' 'rbenv-gem-rehash'
fi
if ! [[ -d $RBENV_ROOT/plugins/rbenv-default-gems ]]; then
puts 'Installing' 'rbenv-default-gems'
git clone https://github.com/sstephenson/rbenv-default-gems.git \
$RBENV_ROOT/plugins/rbenv-default-gems
fi
if [[ -d $RBENV_ROOT/plugins/rbenv-default-gems ]]; then
puts 'Installed' 'rbenv-default-gems'
fi
if ! [[ -d $RBENV_ROOT/plugins/rbenv-ctags ]]; then
puts 'Installing' 'rbenv-ctags'
git clone https://github.com/tpope/rbenv-ctags.git \
$RBENV_ROOT/plugins/rbenv-ctags
fi
if [[ -d $RBENV_ROOT/plugins/rbenv-ctags ]]; then
puts 'Installed' 'rbenv-default-ctags'
fi
if ! [[ -d $PYENV_ROOT ]]; then
puts 'Installing' 'pyenv'
git clone https://github.com/yyuu/pyenv.git $PYENV_ROOT
cd $PYENV_ROOT
git checkout $(git describe --abbrev=0 --tags)
fi
if [[ -d $PYENV_ROOT ]]; then
puts 'Installed' 'pyenv'
fi
if ! [[ -d $PYENV_ROOT/plugins/pyenv-virtualenv ]]; then
puts 'Installing' 'pyenv-virtualenv'
git clone https://github.com/yyuu/pyenv-virtualenv.git \
$PYENV_ROOT/plugins/pyenv-virtualenv
cd $PYENV_ROOT/plugins/pyenv-virtualenv
git checkout $(git describe --abbrev=0 --tags)
fi
if [[ -d $PYENV_ROOT/plugins/pyenv-virtualenv ]]; then
puts 'Installed' 'pyenv-virtualenv'
fi
if ! [[ -d $NVM_DIR ]]; then
puts 'Installing' 'nvm'
git clone https://github.com/creationix/nvm.git $NVM_DIR
cd $NVM_DIR
git checkout $(git describe --abbrev=0 --tags)
fi
if [[ -d $NVM_DIR ]]; then
puts 'Installed' 'nvm'
fi
if ! [[ -h $HOME/.local/share/nvim/site/spell ]]; then
mkdir -p $HOME/.local/share/nvim/site
if [[ -d /usr/share/vim/vimfiles/spell ]]; then
ln -s /usr/share/vim/vimfiles/spell $HOME/.local/share/nvim/site
fi
fi
if ! [[ -d $HOME/.config/nvim/plugged/nvimrc ]]; then
puts 'Installing' 'nvimrc'
curl -L https://rc.evansosenko.com/nvimrc/install.sh | sh
fi
if [[ -d $HOME/.config/nvim/plugged/nvimrc ]]; then
puts 'Installed' 'nvimrc'
fi
if ! [[ -d $HOME/.config/tmux/plugins/tmuxrc ]]; then
if [[ ! -z "${TMUX:-}" ]]; then
puts 'Installing' 'tmuxrc'
curl -L https://rc.evansosenko.com/tmuxrc/install.sh | sh
puts 'Installed' 'tmux plugins'
else
puts 'Info' 'Run in a tmux session to install tmuxrc.'
fi
fi
if [[ -d $HOME/.config/tmux/plugins/tmuxrc ]]; then
puts 'Installed' 'tmuxrc'
fi
if ! [[ -e $HOME/.config/zsh/promptline.zsh ]]; then
if [[ -d $HOME/.config/nvim/plugged/promptline.vim ]]; then
puts 'Installing' 'promptline'
nvim -c "PromptlineSnapshot ~/.config/zsh/promptline.zsh" -c qall!
fi
fi
if [[ -e $HOME/.config/zsh/promptline.zsh ]]; then
puts 'Installed' 'promptline'
fi
if ! [[ -e $HOME/.config/tmux/tmuxline.conf ]] then
if [[ -d $HOME/.config/nvim/plugged/tmuxline.vim ]]; then
if [[ ! -z "${TMUX:-}" ]]; then
puts 'Installing' 'tmuxline'
nvim -c "Tmuxline airline" -c "TmuxlineSnapshot! ~/.config/tmux/tmuxline.conf" -c qall!
else
puts 'Info' 'Run in a tmux session to install tmuxline.'
fi
fi
fi
if [[ -e $HOME/.tmuxline.conf ]]; then
puts 'Installed' 'tmuxline'
fi
if [[ "${SHELL:-}" != "/bin/zsh" ]]; then
puts 'Change Shell' 'zsh'
chsh -s /bin/zsh
fi
exit