-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.ps1
70 lines (57 loc) · 2.8 KB
/
setup.ps1
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
# To run this script, you need to run Powershell as an Administrator and then run
# Set-ExecutionPolicy RemoteSigned
# Accept the changes
function Copy-File ([System.String] $sourceFile, [System.String] $destinationFile, [Switch] $overWrite) {
if ($sourceFile -notlike "filesystem::*") {
$sourceFile = "filesystem::$sourceFile"
}
if ($destinationFile -notlike "filesystem::*") {
$destinationFile = "filesystem::$destinationFile"
}
$destinationFolder = $destinationFile.Replace($destinationFile.Split("\")[-1],"")
if (!(Test-Path -path $destinationFolder)) {
New-Item $destinationFolder -Type Directory
}
try {
Copy-Item -Path $sourceFile -Destination $destinationFile -Recurse -Force
Return $true
} catch [System.IO.IOException] {
# If overwrite enabled, then delete the item from the destination, and try again:
if ($overWrite) {
try {
Remove-Item -Path $destinationFile -Recurse -Force
Copy-Item -Path $sourceFile -Destination $destinationFile -Recurse -Force
Return $true
} catch {
Write-Error -Message "[Copy-File] Overwrite error occurred!`n$_" -ErrorAction SilentlyContinue
#$PSCmdlet.WriteError($Global:Error[0])
Return $false
}
} else {
Write-Error -Message "[Copy-File] File already exists!" -ErrorAction SilentlyContinue
#$PSCmdlet.WriteError($Global:Error[0])
Return $false
}
} catch {
Write-Error -Message "[Copy-File] File move failed!`n$_" -ErrorAction SilentlyContinue
#$PSCmdlet.WriteError($Global:Error[0])
Return $false
}
}
Write-Host "Installing required software"
pip install neovim
npm install -g neovim
gem install neovim
Write-Host "Copying Vim configuration files to correct locations"
# init.vim
Copy-File ([string](Get-Location) + '\config\.config\nvim\init.vim') ($ENV:USERPROFILE + '\AppData\Local\nvim\init.vim') $false
Copy-File ([string](Get-Location) + '\config\.config\nvim\init.vim') ($ENV:USERPROFILE + '\vimfiles\vimrc') $false
# ultisnips.vim
Copy-File ([string](Get-Location) + '\config\.config\nvim\ultisnips.vim') ($ENV:USERPROFILE + '\AppData\Local\nvim\ultisnips.vim') $false
Copy-File ([string](Get-Location) + '\config\.config\nvim\ultisnips.vim') ($ENV:USERPROFILE + '\vimfiles\ultisnips.vim') $false
# coc-settings.json
Copy-File ([string](Get-Location) + '\config\.config\nvim\coc-settings.json') ($ENV:USERPROFILE + '\AppData\Local\nvim\coc-settings.json') $false
Copy-File ([string](Get-Location) + '\config\.config\nvim\coc-settings.json') ($ENV:USERPROFILE + '\vimfiles\coc-settings.json') $false
Write-Host "Setup (n)Vimm plugins"
nvim +PlugInstall +qall
vim +PlugInstall +qall