Dan Anglin
59a6969c25
Download and install configurations from external sources. At the moment downloading from external git repositories is only supported. Download and install the Neovim configuration for sparrow. Add an external script to install lazy.nvim.
48 lines
1.4 KiB
Bash
Executable file
48 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
if [ -z ${1+x} ]; then
|
|
echo "ERROR: Please specify the version of neovim that you want to install"
|
|
exit 1
|
|
fi
|
|
|
|
VERSION="$( echo ${1} | sed 's/v//g' )"
|
|
|
|
echo "Installing neovim version ${VERSION}"
|
|
|
|
INSTALLATION_DIR="${HOME}/.local/opt/nvim"
|
|
SYMLINK="${HOME}/.local/bin/nvim"
|
|
DOWNLOAD_DIR="${HOME}/Downloads/nvim-${VERSION}"
|
|
|
|
if [[ -d "${INSTALLATION_DIR}" ]]; then
|
|
echo "Moving ${INSTALLATION_DIR} to ${INSTALLATION_DIR}.previous"
|
|
mv "${INSTALLATION_DIR}" "${INSTALLATION_DIR}.previous"
|
|
fi
|
|
|
|
echo "Creating ${INSTALLATION_DIR}"
|
|
mkdir "${INSTALLATION_DIR}"
|
|
|
|
echo "Downloading neovim to ${DOWNLOAD_DIR}"
|
|
mkdir "${DOWNLOAD_DIR}"
|
|
curl -s \
|
|
-L "https://github.com/neovim/neovim/releases/download/v${VERSION}/nvim-linux64.tar.gz" \
|
|
-o "${DOWNLOAD_DIR}/nvim-linux64.tar.gz"
|
|
|
|
curl -s \
|
|
-L "https://github.com/neovim/neovim/releases/download/v${VERSION}/nvim-linux64.tar.gz.sha256sum" \
|
|
-o "${DOWNLOAD_DIR}/nvim-linux64.tar.gz.sha256sum"
|
|
|
|
echo "Verifying the package"
|
|
cd "${DOWNLOAD_DIR}"
|
|
sha256sum --check nvim-linux64.tar.gz.sha256sum
|
|
|
|
# extract contents to the installation directory
|
|
echo "Extracting the package to ${INSTALLATION_DIR}"
|
|
tar xzf "${DOWNLOAD_DIR}/nvim-linux64.tar.gz" --strip-components=1 -C "${INSTALLATION_DIR}"
|
|
|
|
# create the symlink
|
|
echo "Creating the symbolic link ${SYMLINK}"
|
|
ln -sf "${INSTALLATION_DIR}/bin/nvim" "${SYMLINK}"
|