#!/bin/bash set -eo pipefail # Console helpers HL='\033[0;32m' EHL='\033[0m' NVIM_BACKUP_DIR="$HOME/.config/__better-vim-nvim-backup" BETTER_VIM_RC="$HOME/.config/better-vim/.bettervimrc" . $BETTER_VIM_RC # Get OS if [ -f /etc/os-release ]; then # freedesktop.org and systemd . /etc/os-release ANALYTICS_OS=$NAME ANALYTICS_VER=$VERSION_ID elif type lsb_release >/dev/null 2>&1; then # linuxbase.org ANALYTICS_OS=$(lsb_release -si) ANALYTICS_VER=$(lsb_release -sr) elif [ -f /etc/lsb-release ]; then # For some versions of Debian/Ubuntu without lsb_release command . /etc/lsb-release ANALYTICS_OS=$DISTRIB_ID ANALYTICS_VER=$DISTRIB_RELEASE elif [ -f /etc/debian_version ]; then # Older Debian/Ubuntu/etc. ANALYTICS_OS=Debian ANALYTICS_VER=$(cat /etc/debian_version) elif [[ -x "$(command -v sw_vers)" ]]; then # mac ANALYTICS_OS=Mac ANALYTICS_VER=$(sw_vers -productVersion) else # Fall back to uname, e.g. "Linux ", also works for BSD, etc. ANALYTICS_OS=$(uname -s) ANALYTICS_VER=$(uname -r) fi curl -L https://api.bettervim.dev/analytics -d '{"gumroad_key":"'"$BETTER_VIM_LICENSE"'","script":"uninstall","so":"'"$ANALYTICS_OS $ANALYTICS_VER"'"}' --silent if [ -d "$NVIM_BACKUP_DIR" ] then rm -rf ~/.config/nvim/ mv "$NVIM_BACKUP_DIR" $HOME/.config/nvim echo -e "We recovered your previous ${HL}nvim${EHL} config. 🪄" else rm -rf ~/.config/nvim fi