52 lines
2.0 KiB
Bash
52 lines
2.0 KiB
Bash
PACKER_NVIM_INSTALL_PATH="${HOME}/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
|
NVIM_CONF_URL="https://gitlab.orion-technologies.io/backups/neovim-backup.git"
|
|
DOT_CONFIG_PATH="${HOME}/.config/"
|
|
NVIM_CONF_PATH="${DOT_CONFIG_PATH}/nvim"
|
|
|
|
required_packages=(universal-ctags fzf ripgrep neovim)
|
|
|
|
# Handle Installation Per OS
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
if ! which brew 1>/dev/null 2>&1; then
|
|
echo "Installing brew, why the fuck aren't you using it...?"
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 1>/dev/null 2>&1
|
|
fi
|
|
for package in "${required_packages[@]}"; do
|
|
echo "Installing ${package}"
|
|
brew install "${package}" 1>/dev/null 2>&1
|
|
done
|
|
else
|
|
OS_RELEASE="$(grep ^NAME= /etc/os-release | cut -d "=" -f2 | tr -d '"')"
|
|
if [[ "${OS_RELEASE}" = *"Ubuntu"* ]]; then
|
|
apt install -y "${required_packages[@]}"
|
|
fi
|
|
fi
|
|
|
|
if [[ ! -d "${PACKER_NVIM_INSTALL_PATH}" ]]; then
|
|
echo "Installing packer.nvim as it is not installed"
|
|
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
|
|
"${PACKER_NVIM_INSTALL_PATH}" || echo "packer.nvim already installed"
|
|
fi
|
|
|
|
if [[ ! -d "${HOME}/.config" ]]; then
|
|
echo "The .config directory does not exist, creating now"
|
|
mkdir -p "${HOME}/.config"
|
|
fi
|
|
|
|
if [[ -d "${NVIM_CONF_PATH}" ]]; then
|
|
backup_nvim_conf_path="${DOT_CONFIG_PATH}/$(basename "${NVIM_CONF_PATH}")-$(date +%Y-%m-%dT%H:%M:%S)"
|
|
echo "Backing up ${NVIM_CONF_PATH} to ${backup_nvim_conf_path}"
|
|
mv "${NVIM_CONF_PATH}" "${backup_nvim_conf_path}"
|
|
fi
|
|
|
|
echo "Installing packer"
|
|
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
|
|
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
|
|
|
echo "Installing neovim configuration from ${NVIM_CONF_URL}"
|
|
git clone "${NVIM_CONF_URL}" ~/.config/nvim
|
|
|
|
echo "Moving into nvim, do not be alarmed it is going to look a mess, give it a minute and then restart once all operations are complete"
|
|
nvim +PackerSync
|
|
|