-
Notifications
You must be signed in to change notification settings - Fork 0
/
initialize
executable file
·57 lines (46 loc) · 968 Bytes
/
initialize
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
#!/bin/sh
dotfiles_dir="`dirname "$0"`"
if [ "`pwd`" != "$HOME" ] && [ "$1" != "-f" ]; then
echo >&2 "The script should be run in your home directory. To force it"
echo >&2 "to run anyway, give option -f"
exit 1
fi
[ "$1" = "-f" ] && shift
link_dotfiles() {
while [ $# -gt 0 ]; do
ln -s "$dotfiles_dir/$1" ".$1"
shift
done
}
setup_git() {
git config --global user.name "Henri Vettenranta"
git config --global user.email [email protected]
git config --global core.excludesfile "$dotfiles_dir/gitexcludes"
}
setup_vim() {
ln -s "$dotfiles_dir/vimfiles/vimrc" .vimrc
ln -s "$dotfiles_dir/vimfiles/gvimrc" .gvimrc
ln -s "$dotfiles_dir/vimfiles" .vim
}
setup_zsh() {
link_dotfiles zshrc zshenv zprofile
}
setup_tmux() {
link_dotfiles tmux.conf
}
setup_all() {
setup_git
setup_vim
setup_zsh
setup_tmux
}
command="$1"
case "$command" in
all|tmux|zsh|vim|git)
setup_$command
;;
*)
echo >&2 "Unknown command: $command"
exit 1
;;
esac