Skip to content

Instantly share code, notes, and snippets.

@RicherMans
Forked from wsntxxn/install.sh
Last active April 7, 2021 01:57
Show Gist options
  • Save RicherMans/0a7b4a7c983962065ba81a71d1e4cd28 to your computer and use it in GitHub Desktop.
Save RicherMans/0a7b4a7c983962065ba81a71d1e4cd28 to your computer and use it in GitHub Desktop.
neovim and coc installing script
# 1. install neovim
echo "[step 1] installing neovim"
if command -v nvim > /dev/null; then
echo "nvim has been installed"
else
NVIM_HOME="$HOME/modules/neovim"
printf "Neovim will be installed into this location:\\n"
printf "%s\\n" "${NVIM_HOME}"
printf "\\n"
printf " - Press ENTER to confirm the location\\n"
printf " - Or specify a different location below\\n"
printf "\\n"
printf "[%s] >>> " "${NVIM_HOME}"
read -r user_nvim_home
if [ "$user_nvim_home" != "" ]; then
case "$user_nvim_home" in
*\ * )
printf "ERROR: Cannot install into directories with spaces\\n" >&2
exit 1
;;
*)
eval NVIM_HOME="$user_nvim_home"
;;
esac
fi
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
if [[ ! -d ${NVIM_HOME}/bin ]]; then
mkdir -p ${NVIM_HOME}/bin
fi
mv nvim.appimage ${NVIM_HOME}/nvim
echo "export PATH=\"\$PATH:${NVIM_HOME}/bin\"" >> $HOME/.bashrc
source $HOME/.bashrc
fi
# 2. install node.js
echo "[step 2] installing and node.js"
if command -v node > /dev/null; then
echo "node has been installed"
else
NODE_HOME="$HOME/modules/node"
printf "Node.js will be installed into this location:\\n"
printf "%s\\n" "${NODE_HOME}"
printf "\\n"
printf " - Press ENTER to confirm the location\\n"
printf " - Or specify a different location below\\n"
printf "\\n"
printf "[%s] >>> " "${NODE_HOME}"
read -r user_node_home
if [ "$user_node_home" != "" ]; then
case "$user_node_home" in
*\ * )
printf "ERROR: Cannot install into directories with spaces\\n" >&2
exit 1
;;
*)
eval NODE_HOME="$user_node_home"
;;
esac
fi
wget https://nodejs.org/dist/v14.15.0/node-v14.15.0-linux-x64.tar.xz
tar xvf node-v14.15.0-linux-x64.tar.xz
if [[ ! -d ${NODE_HOME} ]]; then
mkdir -p ${NODE_HOME}
fi
mv node-v14.15.0-linux-x64/* ${NODE_HOME}
rmdir node-v14.15.0-linux-x64
echo "export PATH=\"\$PATH:${NODE_HOME}/bin\"" >> $HOME/.bashrc
source $HOME/.bashrc
fi
# 3. install node.js packages via npm
echo "[step 3] installing node.js packages: neovim and yarn"
npm install -g neovim yarn
# 4. install Plug
echo "[step 4] installing plug"
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
# 5. install plugins via Plug
echo "[step 5] installing plugins"
if [[ ! -d $HOME/.config/nvim ]]; then
mkdir -p $HOME/.config/nvim
fi
if [[ ! -f $HOME/.config/nvim/init.vim ]]; then
wget https://gist.githubusercontent.com/wsntxxn/5bbe7856a472985d82f62e1b0895ce60/raw/fc7db25e1af2b9dae8969021c52c21ce06be3bb5/init.vim -P $HOME/.config/nvim/
fi
nvim +'PlugInstall --sync' +qa
# 6. install packages via pip
echo "[step 6] installing python packages: neovim and notedown"
pip install neovim notedown
# 7. postprocessing for semshi
echo "[step 7] post processing step for installing semshi"
nvim +'UpdateRemotePlugins' +qa
# 8. install coc plugins
echo "[step 8] installing coc plugins"
nvim +'CocInstall coc-python coc-json coc-jedi'
echo "Finish installing neovim and coc.nvim!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment