-
Notifications
You must be signed in to change notification settings - Fork 0
/
vim-setup.sh
executable file
·55 lines (47 loc) · 1.31 KB
/
vim-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
48
49
50
51
52
53
54
#! /bin/bash
echo $'#############################
### Vim Config Start ###
#############################'
link() {
CUR_TIME=`date "+%Y-%m-%d-%H-%M-%S"`
if [ -d ~/.vim ]
then
mv ~/.vim ~/.vim-${CUR_TIME}
echo "move ~/.vim to ~/.vim-${CUR_TIME}"
fi
cp -a ./vim ~/.vim
if [ -f ~/.vimrc ]
then
mv ~/.vimrc ~/.vimrc-${CUR_TIME}
echo "move ~/.vimrc to ~/.vimrc-${CUR_TIME}"
fi
ln -s ~/.vim/vimrc ~/.vimrc &> /dev/null
if [ ! $? -eq 0 ]
then
echo "Error: link vimrc failed"
exit -1
fi
}
config_vundle() {
if [ ! -d ~/.vim/bundle ]
then
mkdir -p ~/.vim/bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
if [ ! $? -eq 0 ]
then
echo "Error: Install vundle failed"
exit -1
fi
fi
echo "Vundle install ok"
hash vim 2>/dev/null || { \
echo "vim command not found"; exit -1; }
vim --not-a-term +PluginInstall +qall
git clone https://github.com/Valloric/YouCompleteMe ~/.vim/bundle/YouCompleteMe
cd ~/.vim/bundle/YouCompleteMe && git submodule update --init --recursive && ./install.py --clang-completer --go-completer
}
link
config_vundle
if [ $? -eq 0 ]; then
echo "Config Vim OK. Enjoy it :-) "
fi