1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-25 09:20:05 +08:00
SpaceVim/docs/cn/install.cmd

112 lines
3.5 KiB
Batchfile
Raw Normal View History

@PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF
echo " /###### /## /##/## "
echo " /##__ ## | ## | #|__/ "
echo " | ## \__/ /###### /###### /####### /######| ## | ##/##/######/#### "
echo " | ###### /##__ ##|____ ##/##_____//##__ #| ## / ##| #| ##_ ##_ ##"
echo " \____ #| ## \ ## /######| ## | ########\ ## ##/| #| ## \ ## \ ##"
echo " /## \ #| ## | ##/##__ #| ## | ##_____/ \ ###/ | #| ## | ## | ##"
echo " | ######| #######| ######| ######| ####### \ #/ | #| ## | ## | ##"
echo " \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/ |__/"
echo " | ## "
echo " | ## "
echo " |__/ "
2020-04-06 21:10:20 +08:00
echo " 版本: 1.5.0-dev 中文官网: https://spacevim.org/cn/ "
Push-Location ~
$app_name = "SpaceVim"
$repo_url = "https://github.com/SpaceVim/SpaceVim.git"
$repo_name = "SpaceVim"
$repo_path = "$HOME\.SpaceVim"
2019-07-23 21:24:13 +08:00
Function Pause ($Message = "请按任意按键继续 . . . ") {
2018-01-28 10:01:14 +08:00
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
}
}
2019-07-23 21:24:13 +08:00
echo "==> 开始检测环境依赖..."
echo ""
sleep 1
2019-07-23 21:24:13 +08:00
echo "==> 测试 git 命令"
if (Get-Command "git" -ErrorAction SilentlyContinue) {
2018-01-28 10:01:14 +08:00
git version
2019-07-23 21:24:13 +08:00
echo "[OK] 测试成功. 开始下一个测试..."
2018-02-02 20:08:36 +08:00
sleep 1
} else {
2018-01-28 10:01:14 +08:00
echo ""
2019-07-23 21:24:13 +08:00
echo "[ERROR] 无法在你的 PATH 中发现 'git.exe' 命令"
echo ">>> 准备退出......"
2018-02-02 20:08:36 +08:00
Pause
exit
}
echo ""
2019-07-23 21:24:13 +08:00
echo "==> 测试 gvim 命令"
if (Get-Command "gvim" -ErrorAction SilentlyContinue) {
2018-01-28 10:01:14 +08:00
echo ($(vim --version) -split '\n')[0]
2019-07-23 21:24:13 +08:00
echo "[OK] 测试成功. 开始下一个测试..."
2018-02-02 20:08:36 +08:00
sleep 1
} else {
2019-07-23 21:24:13 +08:00
echo "[WARNING] 无法在你的 PATH 中发现 'gvim.exe' 命令. 但仍可继续安装..."
2018-02-02 20:08:36 +08:00
echo ""
2019-07-23 21:24:13 +08:00
echo "[WARNING] 请后续安装 gvim 或者正确设置你的 PATH! "
2018-02-02 20:08:36 +08:00
Pause
}
2019-07-23 21:24:13 +08:00
echo "<== 环境依赖检测已完成. 继续下一步..."
sleep 1
echo ""
echo ""
if (!(Test-Path "$HOME\.SpaceVim")) {
2019-07-23 21:24:13 +08:00
echo "==> 正在安装 $app_name"
2018-02-02 20:08:36 +08:00
git clone $repo_url $repo_path
} else {
2019-07-23 21:24:13 +08:00
echo "==> 正在更新 $app_name"
2018-02-02 20:08:36 +08:00
Push-Location $repo_path
git pull origin master
}
echo ""
if (!(Test-Path "$HOME\vimfiles")) {
2018-01-28 10:01:14 +08:00
cmd /c mklink $HOME\vimfiles $repo_path
2019-07-23 21:24:13 +08:00
echo "[OK] 已为 vim 安装 SpaceVim"
2018-02-02 20:08:36 +08:00
sleep 1
2018-01-28 10:01:14 +08:00
} else {
2019-07-23 21:24:13 +08:00
echo "[OK] $HOME\vimfiles 已存在"
2018-02-02 20:08:36 +08:00
sleep 1
2018-01-28 10:01:14 +08:00
}
echo ""
if (!(Test-Path "$HOME\AppData\Local\nvim")) {
cmd /c mklink "$HOME\AppData\Local\nvim" $repo_path
2019-07-23 21:24:13 +08:00
echo "[OK] 已为 neovim 安装 SpaceVim"
2018-02-02 20:08:36 +08:00
sleep 1
} else {
2019-07-23 21:24:13 +08:00
echo "[OK] $HOME\AppData\Local\nvim 已存在"
2018-02-02 20:08:36 +08:00
sleep 1
}
echo ""
2019-07-23 21:24:13 +08:00
echo "安装已完成!"
echo "=============================================================================="
2019-07-23 21:24:13 +08:00
echo "== 打开 Vim 或 Neovim所有插件将会自动安装 =="
echo "=============================================================================="
echo ""
2019-07-23 21:24:13 +08:00
echo "感谢支持 SpaceVim欢迎反馈"
echo ""
Pause
2018-01-27 16:38:19 +08:00
2019-07-23 21:24:13 +08:00
# vim:set ft=powershell nowrap: