-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·69 lines (59 loc) · 1.43 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
#!/bin/bash
# vim: set ft=sh
set -ue
XDG_CONFIG_HOME=$HOME/.config
ROOT_PATH=$PWD
DOT_FILES=(
*rc
zprofile
zshenv
vim
rst2pdf
my.cnf
ctags
tmux.conf
)
make_slink(){
echo installing dotfiles...
for file in "${DOT_FILES[@]}"; do
if [ -L "$HOME/.$file" ]; then
echo "$HOME/.$file is exist"
elif [ -e "$HOME/.$file" ]; then
mv -v "$HOME/.$file" "$HOME/.$file.back"
ln -vsb "$ROOT_PATH/$file" "$HOME/.$file"
else
ln -vs "$ROOT_PATH/$file" "$HOME/.$file"
fi
done
}
configure_gitignore(){
GITIGNORE=~/.gitignore
git config --global core.excludesfile $GITIGNORE
tags_cnt=0
[ -f "$GITIGNORE" ] && tags_cnt=$(grep -c "doc/tags" $GITIGNORE)
if [ "$tags_cnt" -eq 0 ]; then
echo doc/tags >> $GITIGNORE
echo doc/tags-ja >> $GITIGNORE
fi
}
install_vim_plug() {
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/0.11.0/plug.vim
mkdir -p ~/.local/share/nvim/site/autoload/
if [ ! -L ~/.local/share/nvim/site/autoload/plug.vim ]; then
ln -vs ~/.vim/autoload/plug.vim ~/.local/share/nvim/site/autoload/
fi
}
install_alacritty_conf(){
mkdir -p "$XDG_CONFIG_HOME/alacritty"
ln -vs "$ROOT_PATH/alacritty.toml" "$XDG_CONFIG_HOME/alacritty/"
}
main() {
git submodule update --init
make_slink
install_alacritty_conf
install_vim_plug
vim -T dumb -c PlugInstall -c ':q' -c ':q'
configure_gitignore
}
main