2019-07-05 22:59:13 +08:00
|
|
|
@PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF
|
|
|
|
|
2022-04-20 01:31:23 +08:00
|
|
|
Push-Location ~
|
|
|
|
|
|
|
|
$app_name = "SpaceVim"
|
2024-02-19 16:23:34 +08:00
|
|
|
$repo_url = "https://spacevim.org/git/repos/SpaceVim/"
|
2022-04-20 01:31:23 +08:00
|
|
|
$repo_name = "SpaceVim"
|
|
|
|
$repo_path = "$HOME\.SpaceVim"
|
|
|
|
|
|
|
|
echo ""
|
2019-07-05 22:59:13 +08:00
|
|
|
echo " /###### /## /##/## "
|
|
|
|
echo " /##__ ## | ## | #|__/ "
|
|
|
|
echo " | ## \__/ /###### /###### /####### /######| ## | ##/##/######/#### "
|
|
|
|
echo " | ###### /##__ ##|____ ##/##_____//##__ #| ## / ##| #| ##_ ##_ ##"
|
|
|
|
echo " \____ #| ## \ ## /######| ## | ########\ ## ##/| #| ## \ ## \ ##"
|
|
|
|
echo " /## \ #| ## | ##/##__ #| ## | ##_____/ \ ###/ | #| ## | ## | ##"
|
|
|
|
echo " | ######| #######| ######| ######| ####### \ #/ | #| ## | ## | ##"
|
|
|
|
echo " \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/ |__/"
|
|
|
|
echo " | ## "
|
|
|
|
echo " | ## "
|
|
|
|
echo " |__/ "
|
2023-07-05 12:20:47 +08:00
|
|
|
echo " version : v2.3.0-dev by : spacevim.org "
|
2019-07-05 22:59:13 +08:00
|
|
|
|
|
|
|
Function Pause ($Message = "Press any key to continue . . . ") {
|
|
|
|
if ((Test-Path variable:psISE) -and $psISE) {
|
|
|
|
$Shell = New-Object -ComObject "WScript.Shell"
|
|
|
|
$Button = $Shell.Popup("Click OK to continue.", 0, "Script Paused", 0)
|
|
|
|
} else {
|
|
|
|
Write-Host -NoNewline $Message
|
|
|
|
[void][System.Console]::ReadKey($true)
|
|
|
|
Write-Host
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-20 01:31:23 +08:00
|
|
|
echo ""
|
2019-07-05 22:59:13 +08:00
|
|
|
echo "==> Starting Testing Procedure..."
|
|
|
|
echo ""
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
|
|
|
|
echo "==> Testing git"
|
|
|
|
if (Get-Command "git" -ErrorAction SilentlyContinue) {
|
|
|
|
git version
|
|
|
|
echo "[OK] Test successfully. Moving to next..."
|
|
|
|
sleep 1
|
|
|
|
} else {
|
|
|
|
echo ""
|
|
|
|
echo "[ERROR] Unable to find 'git.exe' in your PATH"
|
|
|
|
echo ">>> Ready to Exit......"
|
|
|
|
Pause
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
2022-05-05 21:25:01 +08:00
|
|
|
echo "==> Testing Vim/Neovim"
|
2022-04-20 01:31:23 +08:00
|
|
|
if (Get-Command "vim" -ErrorAction SilentlyContinue) {
|
2019-07-05 22:59:13 +08:00
|
|
|
echo ($(vim --version) -split '\n')[0]
|
|
|
|
echo "[OK] Test successfully. Moving to next..."
|
|
|
|
sleep 1
|
2022-05-05 21:25:01 +08:00
|
|
|
} elseif (Get-Command "nvim" -ErrorAction SilentlyContinue) {
|
|
|
|
echo ($(nvim --version) -split '\n')[0]
|
|
|
|
echo "[OK] Test successfully. Moving to next..."
|
|
|
|
sleep 1
|
2019-07-05 22:59:13 +08:00
|
|
|
} else {
|
|
|
|
echo ""
|
2022-05-05 21:25:01 +08:00
|
|
|
echo "[ERROR] Unable to find 'vim.exe' or 'nvim.exe' in your PATH"
|
|
|
|
echo "Please install neovim/vim later or make your PATH correctly set!"
|
2022-04-20 01:31:23 +08:00
|
|
|
echo ">>> Ready to Exit......"
|
2019-07-05 22:59:13 +08:00
|
|
|
Pause
|
2022-04-20 01:31:23 +08:00
|
|
|
exit
|
2019-07-05 22:59:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
echo ""
|
2022-04-20 01:31:23 +08:00
|
|
|
echo "<== Testing Procedure Completed. Moving to next..."
|
2019-07-05 22:59:13 +08:00
|
|
|
echo ""
|
2022-04-20 01:31:23 +08:00
|
|
|
sleep 1
|
2019-07-05 22:59:13 +08:00
|
|
|
|
2022-04-20 01:31:23 +08:00
|
|
|
if (!(Test-Path $HOME\.SpaceVim)) {
|
2019-07-05 22:59:13 +08:00
|
|
|
echo "==> Trying to clone $app_name"
|
|
|
|
git clone $repo_url $repo_path
|
2022-04-20 01:31:23 +08:00
|
|
|
echo "<== $app_name cloned"
|
2019-07-05 22:59:13 +08:00
|
|
|
} else {
|
|
|
|
echo "==> Trying to update $app_name"
|
|
|
|
Push-Location $repo_path
|
|
|
|
git pull origin master
|
2022-04-20 01:31:23 +08:00
|
|
|
Pop-Location
|
|
|
|
echo "<== $app_name updated"
|
2019-07-05 22:59:13 +08:00
|
|
|
}
|
|
|
|
|
2022-04-20 01:31:23 +08:00
|
|
|
if (Test-Path $HOME/_vimrc) {
|
|
|
|
mv $HOME/_vimrc $HOME\vimfiles_back
|
|
|
|
echo "Backing up _vimrc"
|
|
|
|
}
|
2019-07-05 22:59:13 +08:00
|
|
|
|
2022-04-20 01:31:23 +08:00
|
|
|
echo ""
|
|
|
|
echo "==> Trying to install $app_name for Vim"
|
|
|
|
if (!(Test-Path $HOME\vimfiles)) {
|
|
|
|
cmd /c mklink /J $HOME\vimfiles $repo_path
|
|
|
|
echo "[OK] vimfiles created"
|
2019-07-05 22:59:13 +08:00
|
|
|
} else {
|
2022-04-20 01:31:23 +08:00
|
|
|
echo "Backing up vimfiles"
|
|
|
|
if (Test-Path $HOME\vimfiles_back) {
|
|
|
|
cmd /c rmdir /s /q $HOME\vimfiles_back
|
|
|
|
}
|
|
|
|
mv $HOME\vimfiles $HOME\vimfiles_back
|
|
|
|
cmd /c mklink /J $HOME\vimfiles $repo_path
|
|
|
|
echo "[OK] vimfiles updated"
|
|
|
|
sleep 1
|
2019-07-05 22:59:13 +08:00
|
|
|
}
|
2022-04-20 01:31:23 +08:00
|
|
|
echo "<== $app_name for Vim installed"
|
2019-07-05 22:59:13 +08:00
|
|
|
echo ""
|
|
|
|
|
2022-04-20 01:31:23 +08:00
|
|
|
if (Get-Command "nvim" -ErrorAction SilentlyContinue) {
|
|
|
|
echo "==> Trying to install $app_name for Neovim"
|
|
|
|
if (!(Test-Path $HOME\AppData\Local\nvim)) {
|
|
|
|
cmd /c mklink /J "$HOME\AppData\Local\nvim" $repo_path
|
|
|
|
echo "[OK] nvim created"
|
2019-07-05 22:59:13 +08:00
|
|
|
} else {
|
2022-04-20 01:31:23 +08:00
|
|
|
if (Test-Path $HOME\AppData\Local\nvim_back) {
|
|
|
|
cmd /c rmdir /s /q $HOME\AppData\Local\nvim_back
|
|
|
|
}
|
|
|
|
cmd /c rmdir /s /q $HOME\vimfiles_back
|
|
|
|
mv $HOME\AppData\Local\nvim $HOME\AppData\Local\nvim_back
|
|
|
|
cmd /c mklink /J $HOME\AppData\Local\nvim $repo_path
|
|
|
|
echo "[OK] nvim updated"
|
|
|
|
sleep 1
|
2019-07-05 22:59:13 +08:00
|
|
|
}
|
2022-04-20 01:31:23 +08:00
|
|
|
echo "<== $app_name for Neovim installed"
|
|
|
|
}
|
|
|
|
|
|
|
|
Pop-Location
|
2019-07-05 22:59:13 +08:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Almost done!"
|
|
|
|
echo "=============================================================================="
|
2022-04-20 01:31:23 +08:00
|
|
|
echo "== Open Vim or Neovim and it will install the plugins automatically =="
|
2019-07-05 22:59:13 +08:00
|
|
|
echo "=============================================================================="
|
|
|
|
echo ""
|
|
|
|
echo "That's it. Thanks for installing $app_name. Enjoy!"
|
|
|
|
echo ""
|
|
|
|
Pause
|