-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·79 lines (62 loc) · 1.72 KB
/
install.sh
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
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
DOTFILES=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
function make:clean (){
find "${HOME}" -type l -print0 |
while IFS= read -r -d $'\0' file; do
if [[ $(readlink -f "${file}") == ${DOTFILES}* ]]; then
rm -f "${file}"
fi
done
}
function make:dir () {
for d in "$@"; do
mkdir -p "${HOME}/${d}"
done
}
function make:link () {
local src="${DOTFILES}/${1}"
local dst="${HOME}/${2}"
ln -snf "${src}" "${dst}"
}
function git:clone () {
local repo="${1}"
local dest="${HOME}/${2}"
if [[ -d $dest ]]; then
pushd "${dest}"
git pull --tags --prune
popd
else
git clone "${repo}" "${dest}"
fi
}
function setup:vim () {
make:dir .vim
make:link vim/vimrc .vim/
make:link vim/ftplugin .vim/
make:link vim/snippets .vim/
local src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
local dst="${HOME}/.vim/autoload/plug.vim"
curl --silent --fail --location\
--create-dirs --output "${dst}"\
"${src}"
vim -e +PlugInstall +qa 2>/dev/null || true
}
function main () {
cd "${DOTFILES}"
make:clean
ln -snf /dev/null "${HOME}/.xsession-errors"
make:dir .cache .config .local/bin
make:link ackrc .config/
make:link bash .config/
make:link bash/bashrc .bashrc
make:link bc .config/
make:link git .config/
make:link inputrc .config/
make:link mpv .config/
make:link profile .profile
make:link tmux.conf .tmux.conf
setup:vim
}
main