-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
executable file
·220 lines (182 loc) · 5.85 KB
/
install
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
219
220
#!/usr/bin/env bash
here="$(dirname "$0")"
here="$(cd "$here"; pwd)"
mkdir -p ${XDG_CONFIG_HOME:=$HOME/.config}
install_submodules() {
echo "Installing submodules"
git submodule init
git submodule update
}
install_basic_packages() {
echo "Download package lists"
sudo apt-get update -q -y 2>&1 >/dev/null
echo "Install basic tools"
sudo apt-get install -y \
ack-grep \
aspell \
aspell-en \
build-essential \
cargo \
dnsutils \
fish \
fonts-inconsolata \
git \
golang-go \
foot \
htop \
httpie \
libmagickwand-dev \
libreadline-dev \
libssl-dev \
libyaml-dev \
mailutils \
mailutils-pop3d \
make \
ncal \
ncdu \
ntp \
tidy \
tmux \
tree \
wget \
zlib1g-dev \
2>&1 >/dev/null
}
install_local_bin() {
mkdir -p "${HOME}/.local/bin"
for file in "${here}/bin"/*; do
name="$(basename "$file")"
ln -sfv "$file" "${HOME}/.local/bin/${name}"
done
}
link_dotfiles() {
echo "Link dotfiles"
dotfiles=(gitattributes rdebugrc rspec tmux.conf)
for file in "${dotfiles[@]}"; do
dotname=".${file}"
ln -sfv "${here}/${file}" "${HOME}/${dotname}"
done
}
setup_git() {
# Core configurations
git config --global core.editor "vim"
git config --global core.excludesFile "~/.gitignore"
# Color configurations
git config --global color.ui "auto"
git config --global color.branch.current "yellow reverse"
git config --global color.branch.local "yellow"
git config --global color.branch.remote "green"
git config --global color.diff.meta "yellow bold"
git config --global color.diff.frag "magenta bold"
git config --global color.diff.old "red bold"
git config --global color.diff.new "green bold"
git config --global color.status.added "yellow"
git config --global color.status.changed "green"
git config --global color.status.untracked "cyan"
# Push configurations
git config --global push.default "current"
# Pager configurations
git config --global pager.diff "diff-so-fancy | less --tabs=1,5 -RFX"
git config --global pager.show "diff-so-fancy | less --tabs=1,5 -RFX"
# Alias configurations
git config --global alias.a "add"
git config --global alias.br "branch"
git config --global alias.ca "commit --amend"
git config --global alias.ci "commit"
git config --global alias.co "checkout"
git config --global alias.dfc "diff --cached"
git config --global alias.df "diff"
git config --global alias.fix "commit -am 'fix'"
git config --global alias.last "describe --abbrev=0 --tags"
git config --global alias.lbranch "log --graph --simplify-by-decoration --pretty=format:'%C(yellow)%h%C(white)%d %C(bold black)%ar %C(reset)%n' --all"
git config --global alias.lg "log -p"
git config --global alias.lola "log --graph --decorate --pretty=oneline --abbrev-commit --all"
git config --global alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit"
git config --global alias.ls "ls-files"
git config --global alias.pl "pull"
git config --global alias.ps "push"
git config --global alias.purge "!git checkout master && git pull && git remote prune origin && git branch --merged | grep -v 'master' | xargs git branch -D"
git config --global alias.refactor "commit -am 'refactor'"
git config --global alias.report "!git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ | column -t -s '*'"
git config --global alias.rpo "remote prune origin"
git config --global alias.rso "remote show origin"
git config --global alias.st "status -sb"
git config --global alias.who "shortlog -s --"
# Pull configurations
git config --global pull.ff "only"
echo "Please set up the following Git options manually:"
echo 'git config --global github.user "john"'
echo 'git config --global user.name "John Doe"'
echo 'git config --global user.email "[email protected]"'
}
setup_foot() {
foot_config_dir="${HOME}/.config/foot"
echo "Configure foot"
mkdir -p "$foot_config_dir"
for file in "${here}/footfiles"/*; do
name="$(basename "$file")"
ln -sfv "$file" "${foot_config_dir}/${name}"
done
}
setup_fish() {
fish_config_dir="${HOME}/.config/fish"
echo "Install fishfiles"
mkdir -p "$fish_config_dir"
for file in "${here}/fishfiles"/*; do
name="$(basename "$file")"
ln -sfv "$file" "${HOME}/.config/fish/${name}"
done
fish_update_completions
}
setup_tmux() {
echo "Setup tmux"
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
echo "Press prefix + I (capital i, as in Install) to fetch the plugin."
}
install_bat() {
echo "Install bat"
wget https://github.com/sharkdp/bat/releases/download/v0.12.0/bat_0.12.0_amd64.deb
sudo dpkg --install bat_0.12.0_amd64.deb
rm bat_0.12.0_amd64.deb
}
install_fzf() {
fzf_directory="${HOME}/.fzf"
if [[ ! -d $fzf_directory ]]; then
echo "Install FZF"
git clone --depth 1 https://github.com/junegunn/fzf.git "$fzf_directory"
cd "$fzf_directory" && ./install --all --no-bash --no-zsh
fi
}
install_rbenv() {
if [[ ! -d ~/.rbenv ]]; then
echo "Install rbenv"
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
~/.rbenv/bin/rbenv init
mkdir -p ~/.rbenv/plugins
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
fi
}
install_skyspell() {
echo "Install skyspell"
sudo apt install libsqlite3-dev libenchant-2-dev aspell aspell-en
cargo install skyspell --version 1.0.1 --locked
cargo install skyspell_kak --version 1.0.1 --locked
}
do_all() {
install_submodules
install_basic_packages
install_local_bin
link_dotfiles
setup_git
setup_foot
setup_fish
setup_tmux
install_fzf
install_bat
install_rbenv
install_skyspell
}
do_all
echo 'Change your shell with chsh -s $(which fish)'
echo 'Then setup rbenv with'
echo 'set -Ux fish_user_paths $HOME/.rbenv/bin $fish_user_paths'