-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·46 lines (40 loc) · 1.08 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
#!/bin/bash
function confirm()
{
read -p "$1 [y/N]" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
return 0
fi
return 1
}
function link_to_home()
{
for f in ${1}; do
if [ -f ~/$f ]; then
if confirm "Overwrite ~/$f?"; then
rm -rf ~/$f
curl -sL -o ~/$f https://raw.githubusercontent.com/MarioAlexis/dotfile/master/$f
echo ~/$f installed!
fi
else
curl -sL -o ~/$f https://raw.githubusercontent.com/MarioAlexis/dotfile/master/$f
echo ~/$f installed!
fi
done
}
##################
# MAIN
##################
# Create ~/bin if not exist
mkdir -p ~/bin
mkdir -p ~/.vim
DOTFILES_TO_INSTALL=".gitconfig .vimrc .zshrc .p10k.zsh .shell_alias .shell_env .shell_functions .shell_vars"
link_to_home "$DOTFILES_TO_INSTALL"
# Install vim plugin
if [ -d ~/.vim/plugged/vim-superman ]; then
vim -c ':PlugUpdate | quitall'
else
vim -c ':PlugInstall | quitall'
find ~/.vim -type f -name "vman" -exec cp {} ~/bin \;
fi