-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·61 lines (50 loc) · 1.63 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
#!/bin/bash
# vim: noexpandtab:sw=4:ts=4
# usage: source_rc "$baserc_escaped" "$rc"
source_rc() {
local baserc="$1"
local rc="$2"
[ -f "$rc" ] || touch "$rc"
if ! grep -Fq "source $baserc" "$rc"; then
echo "source $baserc" >> "$rc"
fi
}
scriptdir="$(unset CDPATH && cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
scriptdir_escaped="$(printf "%q" "$scriptdir")"
# zsh
source_rc "$scriptdir_escaped/zsh/dot.zsh" "$HOME/.zshrc"
echo "note: .zlogin/.zlogout will not be installed automatically"
# vim
[ -f "$HOME/.vimrc" ] || touch "$HOME/.vimrc"
if [ ! -f "$HOME/.vim/autoload/plug.vim" ]; then
mkdir -p "$HOME/.vim/autoload"
ln -vis "$scriptdir/vim/vim-plug/plug.vim" "$HOME/.vim/autoload/plug.vim"
fi
if ! grep -q "$scriptdir_escaped" "$HOME/.vimrc"; then
cat <<- EOF >> "$HOME/.vimrc"
source $scriptdir_escaped/vim/dot.vim
source $scriptdir_escaped/vim/gui.vim
call plug#begin('$HOME/.vim/plugged')
source $scriptdir_escaped/vim/dot-plugins.vim
Plug '$scriptdir_escaped/fzf'
Plug 'junegunn/fzf.vim'
call plug#end()
EOF
fi
# gdb
source_rc "$scriptdir_escaped/gdb/dot.gdb" "$HOME/.gdbinit"
# git
dotgitconfig="$(git config --global --get-all include.path "^$scriptdir/git/dot.gitconfig$")"
if [ -z "$dotgitconfig" ]; then
git config --global --add include.path "$scriptdir/git/dot.gitconfig"
fi
# tmux
source_rc "$scriptdir_escaped/tmux/dot.tmux.conf" "$HOME/.tmux.conf"
# bin
mkdir -p "$HOME/bin"
find "$scriptdir/bin" -type f -executable -exec ln -vis -t "$HOME/bin" "{}" \;
## fzf
"$scriptdir/fzf/install"
[ ! -e "$HOME/.fzf" ] && ln -vis "$scriptdir/fzf" "$HOME/.fzf"
# etc.
#ln -vis "$scriptdir/mutt/.muttrc" "$HOME/.muttrc"