This repository was archived by the owner on Nov 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
83 lines (71 loc) · 2.32 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
74
75
76
77
78
79
80
81
82
#!/bin/bash
# Retrieve path to the install directory
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Check if NeoVim is installed
which nvim &> /dev/null
if [ $? -eq 0 ]; then
neovim_exists=1
else
neovim_exists=0
fi
# Symlink .vim directory
if [ "${DIR}" != "${HOME}/.vim" ] && [ ! -L "${HOME}/.vim" ]; then
if [ -e "${HOME}/.vim" ]; then
echo "Warning: a vim folder already exists in ${HOME}."
echo "Renaming existing folder as ${HOME}/vim_bak."
mv ${HOME}/.vim ${HOME}/vim_bak
fi
echo "Creating symbolic link for .vim folder."
ln -s ${DIR} ${HOME}/.vim
fi
# Symlink .vimrc file
if [ ! -L "${HOME}/.vimrc" ]; then
if [ -e "${HOME}/.vimrc" ] ; then
echo "Warning: a vimrc file already exists in ${HOME}."
echo "Renaming existing file as ${HOME}/vimrc.bak."
mv ${HOME}/.vimrc ${HOME}/vimrc.bak
fi
echo "Creating symbolic link for .vimrc file."
ln -s ${DIR}/vimrc ${HOME}/.vimrc
fi
# Symlink NeoVim's init.vim file
if [ $neovim_exists -eq 1 ] && [ ! -L "${HOME}/.config/nvim/init.vim" ]; then
if [ -e "${HOME}/.config/nvim/init.vim" ] ; then
echo "Warning: an init.vim file already exists in ${HOME}/.config/nvim."
echo "Renaming existing file as ${HOME}/.config/nvim/init.bak."
mv ${HOME}/.config/nvim/init.vim ${HOME}/.config/nvim/init.bak
fi
echo "Creating symbolic link for init.vim file."
mkdir -p ${HOME}/.config/nvim/
ln -s ${DIR}/init.vim ${HOME}/.config/nvim/init.vim
fi
# Create temp directory
if [ ! -d "${HOME}/.vim/temp" ]; then
echo "Creating temp folder."
mkdir ${HOME}/.vim/temp
fi
# Create undo directory
if [ ! -d "${HOME}/.vim/undo" ]; then
echo "Creating undo folder."
mkdir ${HOME}/.vim/undo
fi
# Create bundle directory
if [ ! -d "${HOME}/.vim/bundle" ]; then
echo "Creating bundle folder."
mkdir ${HOME}/.vim/bundle
fi
# Download Vundle plugin manager
if [ ! -d "${DIR}/bundle/Vundle.vim" ]; then
echo "Downloading Vundle plugin manager."
git clone https://github.com/VundleVim/Vundle.vim.git ${DIR}/bundle/Vundle.vim
fi
# Clean, update and install plugins
echo "Cleaning, updating and installing plugins."
vim +PluginClean +PluginUpdate +PluginInstall +qall
# Compile YCM
if [ -d "${DIR}/bundle/YouCompleteMe" ]; then
echo "Compiling YCM."
cd ${DIR}/bundle/YouCompleteMe && ./install.py --clang-completer
fi