-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
73 lines (64 loc) · 2.13 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
plugins=(
https://github.com/tpope/vim-pathogen.git
https://github.com/Lokaltog/vim-powerline.git
https://github.com/jiangmiao/auto-pairs.git
https://github.com/vim-scripts/genutils.git
https://github.com/vim-scripts/multiselect.git
https://github.com/scrooloose/nerdtree.git
https://github.com/msanders/snipmate.vim.git
https://github.com/vim-scripts/taglist.vim.git
https://github.com/lepture/vim-javascript.git
https://github.com/maksimr/vim-jsbeautify.git
https://github.com/sickill/vim-monokai.git
https://github.com/jistr/vim-nerdtree-tabs.git
https://github.com/mattn/zencoding-vim.git
)
vimhomeDir=~/.vim/
vimrcUrl=https://raw.github.com/darkfe/vimconfigfast/master/_vimrc
bundleDir=${vimhomeDir}bundle/
pathogenDir=${bundleDir}vim-pathogen/
if [ ! -d $vimhomeDir ]; then
mkdir $vimhomeDir
fi
for line in ${plugins[*]}
do
if [ "$line" != "###" ]; then
repoUrl=`echo ${line#*#}`
repoName=`echo ${line#*#} | awk '{split($0,a,"/"); print a[5]}' | awk '{split($0,b,".git"); print b[1]}'`
repoDir=$bundleDir$repoName
if [ -d $repoDir ]; then
echo "[$repoName] plugin is allready exsit, try exec git-pull."
cd $repoDir
git pull
cd - >/dev/null
else
if [ "$repoName" == 'taglist.vim' ];then
if type ctags >/dev/null 2>&1 ;then
echo "[$repoName] plugin start install."
git clone $repoUrl $repoDir
else
echo "Cat't find 'ctags', stop install taglist.vim."
fi
else
echo "[$repoName] plugin start install."
git clone $repoUrl $repoDir
fi
fi
else
break
fi
done
if [ -d $pathogenDir ]; then
cp -r $pathogenDir/autoload $vimhomeDir/autoload
#backup old vimrc file
if [ -f ~/.vimrc -a ]; then
if [ ! -d ~/.vimrcbak/ ]; then
mkdir ~/.vimrcbak/
fi
ds=`date +%s`
cp ~/.vimrc ~/vimrcbak/.vimrc_$ds
fi
curl $vimrcUrl > ~/.vimrc
else
echo "[vim-pathogen] install fail, please check your network."
fi