From 4c705bc07d7e0510e88d9ce95e45999e95719144 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 10 Mar 2022 09:54:38 +0100 Subject: feat(windows): add custom config_win.example.lua (#2330) --- utils/installer/uninstall.ps1 | 58 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) (limited to 'utils/installer/uninstall.ps1') diff --git a/utils/installer/uninstall.ps1 b/utils/installer/uninstall.ps1 index b362ff5a..4d6ffa5d 100644 --- a/utils/installer/uninstall.ps1 +++ b/utils/installer/uninstall.ps1 @@ -1 +1,57 @@ -Remove-Item -Path "$HOME/.local/share/lunarvim" -Recurse -Force \ No newline at end of file +#Requires -Version 7.1 +$ErrorActionPreference = "Stop" # exit when command fails + +# set script variables +$LV_BRANCH = $LV_BRANCH ?? "rolling" +$LV_REMOTE = $LV_REMOTE ?? "lunarvim/lunarvim.git" +$INSTALL_PREFIX = $INSTALL_PREFIX ?? "$HOME\.local" + +$env:XDG_DATA_HOME = $env:XDG_DATA_HOME ?? $env:APPDATA +$env:XDG_CONFIG_HOME = $env:XDG_CONFIG_HOME ?? $env:LOCALAPPDATA +$env:XDG_CACHE_HOME = $env:XDG_CACHE_HOME ?? $env:TEMP + +$env:LUNARVIM_RUNTIME_DIR = $env:LUNARVIM_RUNTIME_DIR ?? "$env:XDG_DATA_HOME\lunarvim" +$env:LUNARVIM_CONFIG_DIR = $env:LUNARVIM_CONFIG_DIR ?? "$env:XDG_CONFIG_HOME\lvim" +$env:LUNARVIM_CACHE_DIR = $env:LUNARVIM_CACHE_DIR ?? "$env:XDG_CACHE_HOME\lvim" +$env:LUNARVIM_BASE_DIR = $env:LUNARVIM_BASE_DIR ?? "$env:LUNARVIM_RUNTIME_DIR\lvim" + +$__lvim_dirs = ( + $env:LUNARVIM_BASE_DIR, + $env:LUNARVIM_RUNTIME_DIR, + $env:LUNARVIM_CONFIG_DIR, + $env:LUNARVIM_CACHE_DIR +) + +function main($cliargs) { + Write-Output "Removing LunarVim binary..." + remove_lvim_bin + Write-Output "Removing LunarVim directories..." + $force = $false + if ($cliargs.Contains("--remove-backups")) { + $force = $true + } + remove_lvim_dirs $force + Write-Output "Uninstalled LunarVim!" +} + +function remove_lvim_bin(){ + $lvim_bin="$INSTALL_PREFIX\bin\lvim" + if (Test-Path $lvim_bin) { + Remove-Item -Force $lvim_bin + } + if (Test-Path alias:lvim) { + Write-Warning "Please make sure to remove the 'lvim' alias from your `$PROFILE`: $PROFILE" + } +} + +function remove_lvim_dirs($force) { + foreach ($dir in $__lvim_dirs) { + if (Test-Path $dir) { + Remove-Item -Force -Recurse $dir + } + if ($force -eq $true -and (Test-Path "$dir.bak" -or Test-Path "$dir.old")) { + Remove-Item -Force -Recurse "$dir.{bak,old}" + } + } +} + -- cgit v1.2.3