-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.ps1
70 lines (63 loc) · 1.79 KB
/
install.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
if ($PSVersionTable.PSVersion.Major -lt 6) {
throw "Version of PowerShell has to be not less than 6.0.0"
}
# Powershell
Install-Module -Name posh-git -Force -Scope CurrentUser
Install-Module -Name oh-my-posh -Force -Scope CurrentUser
$VimSettingsDirectory = "$PSScriptRoot\vim\settings"
# Vim plugins
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile(
$uri,
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"$VimSettingsDirectory\plug.vim"
)
)
function Source-Vim-Config($In, $Out)
{
"source $In" > $Out
}
function Make-Symbolic-Link($In, $Out)
{
New-Item -ItemType SymbolicLink -Force -Value $In -Path $Out > $null
}
function Copy-File($In, $Out)
{
Copy-Item $In $Out -Force > $null
}
$VimSettings = "$VimSettingsDirectory\.vim"
@(
@(
$(Get-Item function:Source-Vim-Config),
"$VimSettings",
"$HOME\_vimrc"
),
@(
$(Get-Item function:Source-Vim-Config),
"$VimSettings",
"$env:LOCALAPPDATA\nvim\init.vim"
),
@(
$(Get-Item function:Source-Vim-Config),
"$VimSettingsDirectory\common.vim",
"$HOME\vsvim\common.vim"
),
@(
$(Get-Item function:Source-Vim-Config),
"$VimSettingsDirectory\vs.vim",
"$HOME\_vsvimrc"
),
@(
$(Get-Item function:Copy-File),
"$PSScriptRoot\powershell\profile.ps1",
"$([Environment]::GetFolderPath("MyDocuments"))\PowerShell\Microsoft.PowerShell_profile.ps1"
),
@(
$(Get-Item function:Copy-File),
"$PSScriptRoot\conemu\settings.xml",
"$env:APPDATA\ConEmu.xml"
)
) | foreach {
New-Item -ItemType Directory -Force -Path $(Split-Path -Path $_[2] -Parent) > $null
& $_[0] $_[1] $_[2]
}