-
Notifications
You must be signed in to change notification settings - Fork 254
/
install.cmd
74 lines (62 loc) · 2.34 KB
/
install.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF
echo " _ "
echo " ___ _ __ __ _ ___ ___ __ _(_)_ __ ___ "
echo " / __| -_ \ / _- |/ __/ _ \____\ \ / / | -_ - _ \ "
echo " \__ \ |_) | (_| | (_| __/_____\ V /| | | | | | |"
echo " |___/ .__/ \__._|\___\___| \_/ |_|_| |_| |_|"
echo " |_| "
echo " "
Push-Location ~
$app_name = "space-vim"
$repo_url = "https://github.com/liuchengxu/space-vim.git"
$repo_name = "space-vim"
$repo_path = "$HOME\.space-vim"
if ((Get-Command "git.exe" -ErrorAction SilentlyContinue) -eq $null)
{
Write-Host "Unable to find git.exe in your PATH"
pause
exit
}
if ((Get-Command "vim.exe" -ErrorAction SilentlyContinue) -eq $null)
{
Write-Host "Unable to find vim.exe in your PATH"
pause
exit
}
if (!(Test-Path "$HOME\.space-vim")) {
echo "==> Trying to clone $app_name"
git clone $repo_url $repo_path
} else {
echo "==> Trying to update $app_name"
Push-Location $repo_path
git pull origin master
}
echo ""
if (!(Test-Path "$HOME\.vim\autoload\plug.vim")) {
echo "==> Trying to download vim-plug"
md ~\.vim\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile($uri,$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\.vim\autoload\plug.vim"))
} else {
echo "[OK] plug.vim is ready"
}
if (!(Test-Path "$HOME\.vimrc")) {
cmd /c mklink $HOME\.vimrc $repo_path\init.vim
} else {
echo "[OK] .vimrc already exists"
}
if (!(Test-Path "$HOME\.spacevim")) {
echo "Generating .spacevim from the template"
Copy-Item -Path $repo_path\init.spacevim -Destination $HOME\.spacevim -Force
} else {
echo "[OK] .spacevim already exists"
}
echo ""
echo "Almost done!"
echo "===================================================================="
echo "== Open GVim and it will install the plugins automatically =="
echo "===================================================================="
echo ""
echo "That's it. Thanks for installing $app_name. Enjoy!"
echo ""
pause