-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·126 lines (114 loc) · 3.73 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
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
#!/bin/bash
#adapted from https://github.com/zchrissirhcz/dotfiles/blob/master/install.sh
set -e
# functions
link_directory()
{
SRC_DIR=$1
DST_DIR=$2
if [ ! -d $DST_DIR ]; then
ln -s $SRC_DIR $DST_DIR
else
echo $DST_DIR "already exist, skip linking"
fi
}
link_file()
{
SRC_FILE=$1
DST_FILE=$2
if [ ! -f $DST_FILE ]; then
ln -s $SRC_FILE $DST_FILE
else
echo $DST_FILE "already exist, skip linking"
fi
}
# download
git_clone()
{
if [ ! -d ~/.my_config ]; then
git clone https://github.com/cavalleria/dotfiles.git ~/.my_config
fi
if [ ! -d ~/.my_config/oh-my-zsh ]; then
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.my_config/oh-my-zsh
fi
if [ ! -d ~/.my_config/oh-my-zsh/custom/plugins/zsh-autosuggestions ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.my_config/oh-my-zsh/custom/plugins/zsh-autosuggestions
fi
if [ ! -d ~/.my_config/oh-my-zsh/custom/plugins/zsh-syntax-highlighting ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.my_config/oh-my-zsh/custom/plugins/zsh-syntax-highlighting
fi
if [ ! -d ~/.my_config/oh-my-zsh/custom/plugins/zsh-z ]; then
git clone https://github.com/agkozak/zsh-z ~/.my_config/oh-my-zsh/custom/plugins/zsh-z
fi
# if [ ! -d ~/soft/cheat ]; then
# sysnm="$(tr [A-Z] [a-z] <<< "$(uname)")"
# mkdir -p ~/soft/cheat
# wget -P ~/soft/cheat https://github.com/cheat/cheat/releases/download/4.2.3/cheat-${sysnm}-amd64.gz
# gzip -d ~/soft/cheat/cheat-${sysnm}-amd64.gz
# mv ~/soft/cheat/cheat-${sysnm}-amd64 ~/soft/cheat/cheat
# chmod +x ~/soft/cheat/cheat
# fi
# if [ ! -d ~/.my_config/home/.config/cheat ]; then
# git clone git@github.com:cavalleria/my_cheatsheets.git ~/.my_config/home/.config/cheat
# pushd ~/.my_config/home/.config/cheat
# git submodule update --init
# popd
# fi
echo "-- git clone OK"
}
# folders
link_directory_list()
{
# link_directory ~/.my_config/vim ~/.vim_runtime
link_directory ~/.my_config/oh-my-zsh ~/.oh-my-zsh
# if [ ! -d ~/.config ]; then
# mkdir -p ~/.config
# fi
# link_directory ~/.my_config/home/.config/cheat ~/.config/cheat
echo "-- link directories OK"
}
# files
link_file_list()
{
# link_file ~/.my_config/home/.gitconfig ~/.gitconfig
# link_file ~/.my_config/home/.gitmessage ~/.gitmessage
link_file ~/.my_config/home/.vimrc ~/.vimrc
link_file ~/.my_config/home/.zshrc ~/.zshrc
link_file ~/.my_config/home/.pathrc ~/.pathrc
link_file ~/.my_config/home/.condarc ~/.condarc
link_file ~/.my_config/home/.tmux.conf ~/.tmux.conf
echo "-- link files OK"
}
install()
{
# install vim plugins
if [[ "$(uname)" == "Linux" ]]; then
sed -i 's/colorscheme\ gruvbox8/colorscheme\ default/g' ~/.my_config/vim/vimrcs/my_plugins_config.vim
elif [[ "$(uname)"=="Darwin" ]]; then
sed -i '' 's/colorscheme\ gruvbox8/colorscheme\ default/g' ~/.my_config/vim/vimrcs/my_plugins_config.vim
fi
vim +PlugInstall
if [[ "$(uname)" == "Linux" ]]; then
sed -i 's/colorscheme\ default/colorscheme\ gruvbox8/g' ~/.my_config/vim/vimrcs/my_plugins_config.vim
elif [[ "$(uname)"=="Darwin" ]]; then
sed -i '' 's/colorscheme\ default/colorscheme\ gruvbox8/g' ~/.my_config/vim/vimrcs/my_plugins_config.vim
fi
echo "-- install OK"
}
hello()
{
echo "------------------------------------------"
echo ""
echo " Welcome to use Cavalleria's Config "
echo ""
echo "------------------------------------------"
}
main()
{
hello
git_clone
link_directory_list
link_file_list
install
}
main "$@"