summaryrefslogtreecommitdiff
path: root/utils/installer/uninstall.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/installer/uninstall.sh')
-rwxr-xr-xutils/installer/uninstall.sh26
1 files changed, 21 insertions, 5 deletions
diff --git a/utils/installer/uninstall.sh b/utils/installer/uninstall.sh
index 31007984..236d657f 100755
--- a/utils/installer/uninstall.sh
+++ b/utils/installer/uninstall.sh
@@ -13,8 +13,6 @@ declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}"
# TODO: Use a dedicated cache directory #1256
declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim"
-LVIM_BIN="$(which lvim 2>/dev/null)"
-
declare -a __lvim_dirs=(
"$LUNARVIM_CONFIG_DIR"
"$LUNARVIM_RUNTIME_DIR"
@@ -44,15 +42,33 @@ function parse_arguments() {
done
}
-function main() {
- parse_arguments "$@"
+function remove_lvim_dirs() {
for dir in "${__lvim_dirs[@]}"; do
rm -rf "$dir"
if [ "$ARGS_REMOVE_BACKUPS" -eq 1 ]; then
rm -rf "$dir.bak"
fi
done
- rm -f "$LVIM_BIN"
+}
+
+function remove_lvim_bin() {
+ local legacy_bin="/usr/local/bin/lvim "
+ if [ -x "$legacy_bin" ]; then
+ echo "Error! Unable to remove $legacy_bin without elevation. Please remove manually."
+ exit 1
+ fi
+
+ lvim_bin="$(command -v lvim 2>/dev/null)"
+ rm -f "$lvim_bin"
+}
+
+function main() {
+ parse_arguments "$@"
+ echo "Removing LunarVim binary..."
+ remove_lvim_bin
+ echo "Removing LunarVim directories..."
+ remove_lvim_dirs
+ echo "Uninstalled LunarVim!"
}
main "$@"