-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit
More file actions
executable file
·218 lines (176 loc) · 5.17 KB
/
init
File metadata and controls
executable file
·218 lines (176 loc) · 5.17 KB
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/bin/zsh
setopt EXTENDED_GLOB
setopt +o nomatch
git submodule update --init --recursive
# Create local bin sym links
function() {
local BINDIR=$HOME/.local/bin
mkdir -p $BINDIR
for xfile in ${PWD}/bin/*; do
ln -s "$xfile" "$BINDIR/${xfile:t}"
done
}
#############################
is_mac() {
[[ "$OSTYPE" == "darwin"* ]]
}
is_linux() {
[[ "$OSTYPE" == 'linux-gnu'* ]]
}
command_exists() {
(( $+commands[$1] ));
}
standard_install() {
if ! (command_exists $1); then
echo "\nInstalling $1..."
if is_mac; then
brew install $1
elif is_linux; then
sudo apt-get install $1
fi
fi
}
#############################
# Create sym links for dot configs
echo "\nCreating dot configs..."
for dotfile in ${PWD}/dotconf/*; do
ln -s "$dotfile" "$HOME/.${dotfile:t}"
done
#############################
rm $HOME/.zshrc
# Create zsh config sym links
echo "\nCreating zsh configs..."
for rcfile in "${PWD}"/zsh/configs/*; do
ln -s "$rcfile" "$HOME/.${rcfile:t}"
done
# Create .zshrc.local
function () {
local RCLOCAL=$HOME/.zshrc.local
touch $RCLOCAL
if ! grep -q "export ZSH_THEME_COLOR=" $RCLOCAL; then
cat <<EOF >>$RCLOCAL
export ZSH_THEME_COLOR=66
source ~/.p10k.zsh
alias mount-projects='sudo mount -t nfs \${POISSON_IP}:/srv/nfs/projects ~/projects & sudo mount -t nfs \${POISSON_IP}:/srv/nfs/store ~/store'
if [ -d ~/projects ] && [ ! "\$(ls -A ~/projects)" ]; then
mount-projects
fi
ulimit -n unlimited
restore_tmux "main"
EOF
fi
}
source $HOME/.zshrc
proxy-on
#############################
# Intall homebrew
if is_mac && ! (command_exists brew); then
echo "\nInstalling homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
PATH=$PATH:/opt/homebrew/bin
fi
# Install build-essential
if is_linux; then
sudo apt update
sudo apt install build-essential libfuse2 iftop nfs-common python3-venv
fi
# Create python3 venv
python3 -m venv --system-site-packages $HOME/.venv
source $HOME/.zshrc
# Install pip
if ! (command_exists pip3); then
echo "\nInstalling pip..."
if is_linux; then
sudo apt-get install python3 python3-distutils python3-apt
fi
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
rm get-pip.py
fi
#############################
# Install tmux
echo "\nConfiguring tmux..."
standard_install tmux
git clone git@github.com:tmux-plugins/tpm $HOME/.tmux/plugins/tpm
tmux source $HOME/.tmux.conf
$HOME/.tmux/plugins/tpm/scripts/install_plugins.sh
$HOME/.tmux/plugins/tpm/scripts/source_plugins.sh
pip3 install neovim
# Install node
if ! (command_exists node); then
echo "\nInstalling node..."
curl -sfLS https://install-node.vercel.app | sudo -E bash
fi
npm config set prefix ~/.local
npm install -g neovim
# Install nvim
if ! (command_exists nvim); then
echo "\nInstalling nvim..."
if is_linux; then
sudo apt install libfuse2
fi
${PWD}/scripts/install_neovim
fi
function() {
echo "\nConfiguring vim..."
# Create vim config sym links
local DOT_VIM_DIR=${PWD}/vim
# Create nvim config sym links
if (command_exists nvim); then
mkdir -p $HOME/.config
rm -r $HOME/.config/nvim
ln -sf ${DOT_VIM_DIR}/nvim $HOME/.config/nvim
nvim +UpdateRemotePlugins +qa!
alias vi='nvim'
fi
vi --headless -c 'lua require("lazy").install()' -c 'qa'
}
# Install ag
if ! (command_exists ag); then
echo "\nInstalling ag..."
if is_linux; then
sudo apt-get install silversearcher-ag
elif is_mac; then
brew install the_silver_searcher
fi
fi
# Install tree
standard_install tree
# Install fzf
if [ ! -s $HOME/.fzf ]; then
echo "\nInstalling fzf..."
git clone --depth 1 git@github.com:junegunn/fzf.git $HOME/.fzf
$HOME/.fzf/install --bin
fi
# Install autojump
standard_install autojump
# Install thefuck
if ! (command_exists fuck); then
echo "\nInstalling thefuck..."
pip3 install thefuck
fi
# Install Kitty
if ! (command_exists kitty); then
echo "\nInstalling kitty..."
read "REPLY?Install kitty? [Y/n] "
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
${PWD}/scripts/install_kitty
if is_linux; then
ln -s ~/.local/kitty.app/bin/kitty ~/.local/bin/
cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications/
cp ~/.local/kitty.app/share/applications/kitty-open.desktop ~/.local/share/applications/
wget https://raw.githubusercontent.com/igrmk/whiskers/main/whiskers_256x256.png -O $HOME/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png
sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty*.desktop
sed -i "s|Exec=kitty|Exec=/home/$USER/.local/kitty.app/bin/kitty|g" ~/.local/share/applications/kitty*.desktop
fi
mkdir -p $HOME/.config/kitty
ln -s ${PWD}/kitty/* "$HOME/.config/kitty"
fi
fi
#############################
proxy-off
# Install Julia
if ! (command_exists julia); then
curl -fsSL https://install.julialang.org | sh
fi