-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·47 lines (40 loc) · 896 Bytes
/
setup.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
#!/bin/sh
FILES='.bashrc .bash_profile .gitconfig .vimrc .vim .tmux.conf .screenrc'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function link() {
GIT=`which git`
[[ $GIT =~ ^/([^/]+/)+git$ ]] && echo "git: $GIT" || exit
VIM=`which vim`
[[ $VIM =~ ^/([^/]+/)+vim$ ]] && echo "vim: $VIM" || exit
[[ ! -e "$DIR/backup" ]] && mkdir "$DIR/backup"
cd ~
for f in $FILES
do
[[ -L $f ]] && rm $f
[[ -e $f ]] && mv $f "$DIR/backup/"
ln -s "$DIR/$f"
done
$GIT clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
$VIM +PluginInstall +qall
}
function unlink() {
cd ~
for f in $FILES
do
[[ -e $f ]] && rm $f
done
cp -r "$DIR/backup/." ~
rm -rf "$DIR/backup"
rm -rf "$DIR/.vim/bundle"
}
case $1 in
link)
link
;;
unlink)
unlink
;;
*)
echo "Usage: ${BASH_SOURCE[0]} (link|unlink)"
;;
esac