-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_once_neovim_init
executable file
·55 lines (48 loc) · 1.65 KB
/
run_once_neovim_init
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
#!/bin/bash
# Providers check
NVIMSHAREDIR="$HOME/.local/share/nvim"
TEMPCHECKHEALTHFILE=checkhealth.log
printf "Checking for Python provider...\n"
nvim -N -u NONE -n -es -c ":checkhealth" -c ":w $TEMPCHECKHEALTHFILE"
if [[ ! $(cat $TEMPCHECKHEALTHFILE | grep Py) ]]; then
printf "Please install Python provider before proceeding\n"
rm "$TEMPCHECKHEALTHFILE"
exit -1
fi
rm "$TEMPCHECKHEALTHFILE"
printf "Python provider found! Proceeding...\n\n"
printf "Checking for node provider to Neovim...\n"
if [[ $EUID == 0 ]]; then
NPMCMD=( sudo npm )
else
NPMCMD=( npm )
fi
if [[ ! $(${NPMCMD[@]} install -g neovim) ]]; then
printf "Node provider failed to install. Please install node/npm before proceeding\n"
exit -1
fi
printf "\n"
# vim-plug
VIMPLUGPACKAGEDIR="$NVIMSHAREDIR/plugged"
VIMPLUGTARGETFILE="$NVIMSHAREDIR/site/autoload/plug.vim"
if [[ ! -f "$VIMPLUGTARGETFILE" || ! -d "$VIMPLUGPACKAGEDIR" ]]; then
printf "Attempting to install vim-plug to $VIMPLUGTARGETFILE...\n"
curl -fLo "$VIMPLUGTARGETFILE" --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
printf "Opening neovim to install plugins...\n"
nvim +PlugInstall +qall
printf "\n"
fi
# YouCompleteMe
YCMDIR="$VIMPLUGPACKAGEDIR/YouCompleteMe"
YCMFLAGS=("clang-completer" "cs-completer" "java-completer" "ts-completer")
if [[ -d "$YCMDIR" && ! -e "$YCMDIR/install-complete" ]]; then
printf "Attmpting to install YouCompleteMe...\n"
cwd=$PWD
cd "$YCMDIR"
python3 install.py "${YCMFLAGS[@]/#/--}" && touch "${YCMDIR}/install-complete"
cd "$cwd"
printf "\n"
fi
# Final warnings
printf "Install complete. Consider using :checkhealth to find further issues\n"