-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
52 lines (43 loc) · 1.5 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
#!/bin/bash
BASEDIR=$(dirname $0)
cd $BASEDIR
CURRENT_DIR=`pwd`
lnif() {
if [ -e "$1" ]; then
ln -sf "$1" "$2"
fi
}
echo "Step 1: Backup old configuration"
TODAY=`date +%Y%m%d`
for i in $HOME/.vimrc $HOME/.gvimrc $HOME/.vim $HOME/.vimrc.bundles; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$TODAY; done
for i in $HOME/.vimrc $HOME/.gvimrc $HOME/.vim $HOME/.vimrc.bundles; do [ -L $i ] && unlink $i; done
echo "Step 2: Set up symbol links"
lnif $CURRENT_DIR/vimrc $HOME/.vimrc
lnif $CURRENT_DIR/vimrc.bundles $HOME/.vimrc.bundles
lnif $CURRENT_DIR/ $HOME/.vim
echo "Step 3: Install vundle"
if [ ! -e $CURRENT_DIR/bundle/vundle ]; then
echo "Installing vundle"
git clone https://github.com/gmarik/Vundle.vim.git $CURRENT_DIR/bundle/Vundle.vim
else
echo "Upgrading vundle"
cd "$CURRENT_DIR/bundle/vundle" && git pull origin master
fi
echo "Step 4: Install plugins"
SYSTEM_SHELL=$SHELL
export SHELL="/bin/sh"
vim -u $HOME/.vimrc.bundles +BundleInstall! +BundleClean +qall
export SHEEL=$SYSTEM_SHELL
if [ -e $CURRENT_DIR/bundle/YouCompleteMe ]; then
echo "Step 5: Compile YouCompleteMe"
echo "It will take a long time, please be patient"
echo "If any error occurs, you need to compile it manually"
echo "cd $CURRENT_DIR/bundle/YouCompleteMe/ && bash -x install.sh --clang-completer"
cd $CURRENT_DIR/bundle/YouCompleteMe
if [ `which clang` ]; then
bash -x install.sh --clang-completer --system-libclang
else
bash -x install.sh --clang-completer
fi
fi
echo "Done! Enjoy it!"