-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·69 lines (59 loc) · 1.57 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
#!/bin/bash
VIMBASE=`pwd`
LINKS="$HOME/.config/nvim"
BUNDLE_BASE=$VIMBASE/bundle
VIMBIN=$VIMBASE
CQUERY_REPO="https://github.com/MaskRay/ccls"
LANG_SERVER_BASE="$VIMBASE/lang-server"
LLVM_VER="7.0.1"
LLVM_NAME="clang+llvm-${LLVM_VER}-x86_64-linux-gnu-ubuntu-16.04"
# check dir existence
if [ ! -e $HOME/.config ]; then
mkdir $HOME/.config
fi
# create links
for link in $LINKS; do
if [ -L $link -o -e $link ]; then
rm -r $link
fi
done
ln -s $VIMBASE ${HOME}/.config/nvim
# install dependencies
echo "install dependencies"
pip3 1>/dev/null 2>/dev/null && pip3 install neovim
if [ $? -ne 0 ]; then
echo "python-pip or python3-pip not installed, exit"
exit
fi
echo "install dependecies done"
# install plugins
vim -u $VIMBASE/init-bundle.vim +"PlugInstall!" +"PlugClean!" +"qall"
if [ $? -ne 0 ]; then
echo "installing plugins failed"
exit 1
fi
echo "all plugins cloned"
# install ccls
echo "Installing ccls requires downloading and compiling latest libclang which may take a while"
## clone ccls
if [ ! -e $LANG_SERVER_BASE/ccls ]; then
git clone --recursive $CQUERY_REPO $LANG_SERVER_BASE/ccls
else
echo "ccls already installed"
fi
if [ ! -e $LANG_SERVER_BASE/$LLVM_NAME.tar.xz ]; then
cd $LANG_SERVER_BASE
curl -OL "http://releases.llvm.org/${LLVM_VER}/${LLVM_NAME}.tar.xz"
tar -xf ${LLVM_NAME}.tar.xz
cd $VIMBASE
else
echo "llvm already downloaded"
fi
## build ccls
cd $LANG_SERVER_BASE/ccls
rm -rf $LANG_SERVER_BASE/ccls/Release
cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=../${LLVM_NAME}
cmake --build Release
cd $VIMBASE
# done
echo "done"