forked from wklken/k-vim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
59 lines (47 loc) · 1.46 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
#!/bin/bash
# refer spf13-vim bootstrap.sh`
BASEDIR=$(dirname $0)
cd $BASEDIR
CURRENT_DIR=`pwd`
lnif() {
if [ -e "$1" ]; then
ln -sf "$1" "$2"
fi
}
echo "Step1: backing up current vim config"
today=`date +%Y%m%d`
for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc; do [ -e $i ] && [ ! -L $i ] && mv $i $i.$today; done
for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc; do [ -L $i ] && unlink $i ; done
echo "Step2: setting up symlinks"
lnif $CURRENT_DIR/vimrc $HOME/.vimrc
lnif $CURRENT_DIR/vimrc.bundles $HOME/.vimrc.bundles
lnif "$CURRENT_DIR/" "$HOME/.vim"
echo "Step3: install vundle"
if [ ! -e $CURRENT_DIR/bundle/vundle ]; then
echo "Installing Vundle"
git clone https://github.com/gmarik/vundle.git $CURRENT_DIR/bundle/vundle
else
echo "Upgrade Vundle"
cd "$HOME/.vim/bundle/vundle" && git pull origin master
fi
echo "Step4: update/install plugins using Vundle"
system_shell=$SHELL
export SHELL="/bin/sh"
vim -u $HOME/.vimrc.bundles +BundleInstall! +BundleClean +qall
export SHELL=$system_shell
echo "Step5: compile YouCompleteMe"
echo "It will take a long time, juse be patient!"
echo "If error,you need to compile it yourself"
echo "cd $CURRENT_DIR/bundle/YouCompleteMe/ && bash -x install.sh --clang-completer"
cd $CURRENT_DIR/bundle/YouCompleteMe/
bash -x install.sh --clang-completer
#vim bk and undo dir
if [ ! -d /tmp/vimbk ]
then
mkdir -p /tmp/vimbk
fi
if [ ! -d /tmp/vimundo ]
then
mkdir -p /tmp/vimundo
fi
echo "Install Done!"