Skip to content

Instantly share code, notes, and snippets.

@unrelentingfox
Last active April 19, 2021 20:57
Show Gist options
  • Save unrelentingfox/e8e53368700e44bf8a8d88679a72d7af to your computer and use it in GitHub Desktop.
Save unrelentingfox/e8e53368700e44bf8a8d88679a72d7af to your computer and use it in GitHub Desktop.
A script to use for dynamically installing a tag version of Neovim.
#!/bin/bash
if [ -z "$1" ]
then
TAG="stable"
else
TAG=$1
fi
TMP_FILE=nvim-macos.tar.gz
OUTPUT_DIR_NAME=nvim-osx64
DOWNLOAD_URL=https://github.com/neovim/neovim/releases/download/$TAG/nvim-macos.tar.gz
echo Attempting to install \'$TAG\' version of Neovim
cd /tmp
echo Downloading: $DOWNLOAD_URL
curl -LO $DOWNLOAD_URL
if [[ -f "$TMP_FILE" ]]; then
tar xzf $TMP_FILE
if [[ -d "$OUTPUT_DIR_NAME" ]]; then
if [[ -d "/opt/$OUTPUT_DIR_NAME" ]]; then
sudo rm -rf /opt/$OUTPUT_DIR_NAME.bak
sudo mv /opt/$OUTPUT_DIR_NAME /opt/$OUTPUT_DIR_NAME.bak
fi
sudo mv $OUTPUT_DIR_NAME /opt/$OUTPUT_DIR_NAME
sudo rm -rf /opt/bin/nvim
sudo ln -s /opt/$OUTPUT_DIR_NAME/bin/nvim /opt/bin/nvim
fi
fi
echo Successfully installed \'$TAG\' version of Neovim
/opt/bin/nvim --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment