-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.ps1
50 lines (38 loc) · 1.71 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
Write-Output "preparing environment"
# setup alacritty
Write-Output ".. configuring alacritty"
$alacritty_config = "$home\AppData\Roaming\alacritty"
if (!(Test-Path -Path $nvim_config -PathType Container)) {
New-Item -Path $alacritty_config -ItemType Directory -Force *> $null
}
if (Test-Path -Path "$alacritty_config\alacritty.yml" -PathType Leaf) {
Rename-Item -Path "$alacritty_config\alacritty.yml" -NewName "alacritty.yml.bak" *> $null
}
New-Item -ItemType SymbolicLink -Path "$alacritty_config\alacritty.yml" -Target "$(Get-Location)\alacritty\alacritty.yml" *> $null
# setup neovim
Write-Output ".. configuring neovim"
$nvim_config = "$home\AppData\Local\nvim"
$nvim_autoload = "$nvim_config\autoload"
# install init.vim (from dotfiles directory)
if (!(Test-Path -Path $nvim_config -PathType Container)) {
New-Item -Path $nvim_config -ItemType Directory -Force *> $null
}
if (Test-Path -Path "$nvim_config\init.vim" -PathType Leaf) {
Rename-Item -Path "$nvim_config\init.vim" -NewName "init.vim.bak" *> $null
}
New-Item -ItemType SymbolicLink -Path "$nvim_config\init.vim" -Target "$(Get-Location)\nvim\init.vim" *> $null
# install/update vim-plug
if (!(Test-Path -Path $nvim_autoload -PathType Container)) {
New-Item -Path $nvim_autoload -ItemType Directory -Force *> $null
}
if (!(Test-Path -Path "$nvim_autoload\plug.vim" -PathType Leaf)) {
(New-Object Net.WebClient).DownloadFile(
"https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim",
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"$nvim_autoload\plug.vim"
)
)
}
# execute installation in nvim
Write-Output ".. installing neovim plugins"
nvim --headless +PlugInstall +qa *> $null