-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotfiles-dploy-win.ps1
120 lines (102 loc) · 2.96 KB
/
dotfiles-dploy-win.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# run as admin -or- user must be granted symlink permissions & re-login.
# dotfile directory, set to the script's folder.
$d_dir = "$PSScriptRoot"
# Check if path is symlinked, if not then delete / create dir to desired path.
function PathAndLink {
param (
# real system config path
[string]$cpath,
# dotfile path
[string]$dpath
)
$symtest = get-item $cpath -ErrorAction SilentlyContinue
if (!($symtest)) {
$dir = split-path $cpath
echo "'$cpath' not found! Creating '$dir' path and symlinking '$dpath'"
mkdir -Force $dir > $null
dploy link $dpath $cpath
}
elseif (($symtest.LinkType -eq "SymbolicLink") -eq $false) {
$uInput = Read-Host "'$cpath' is real and exists! Delete? (y/n)"
switch ($uInput) {
y {
rm -Recurse -Force $cpath
dploy link $dpath $cpath
}
Default {}
}
}
else {
echo "'$cpath' already symlinked!"
}
}
# -- Config -- #
# VSCode
$c_code = "$env:APPDATA\Code"
$d_code = "$d_dir\Code"
PathAndLink `
"$c_code\User\snippets\" `
"$d_code\User\snippets\"
PathAndLink `
"$c_code\User\keybindings.json" `
"$d_code\User\keybindings.json"
PathAndLink `
"$c_code\User\settings.json" `
"$d_code\User\settings.json"
PathAndLink `
"$c_code\User\tasks.json" `
"$d_code\User\tasks.json"
PathAndLink `
"$c_code\User\PSScriptAnalyzerSettings.psd1" `
"$d_code\User\PSScriptAnalyzerSettings.psd1"
## VSCodium
#$c_vscodium = "$env:APPDATA\VSCodium"
#$d_vscodium = "$d_dir\VSCodium"
#PathAndLink `
#"$c_vscodium\User\snippets\" `
#"$d_vscodium\User\snippets\"
#PathAndLink `
#"$c_vscodium\User\keybindings.json" `
#"$d_vscodium\User\keybindings.json"
#PathAndLink `
#"$c_vscodium\User\settings.json" `
#"$d_vscodium\User\settings.json"
#PathAndLink `
#"$c_vscodium\User\tasks.json" `
#"$d_vscodium\User\tasks.json"
#PathAndLink `
#"$c_vscodium\User\PSScriptAnalyzerSettings.psd1" `
#"$d_vscodium\User\PSScriptAnalyzerSettings.psd1"
# powershell config
$c_powershell = "$HOME\Documents\WindowsPowerShell"
$d_powershell = "$d_dir\WindowsPowerShell"
PathAndLink `
"$c_powershell\Microsoft.Powershell_profile.ps1" `
"$d_powershell\Microsoft.Powershell_profile.ps1"
PathAndLink `
"$c_powershell\Microsoft.VSCode_profile.ps1" `
"$d_powershell\Microsoft.VSCode_profile.ps1"
# nvim
$c_nvim = "$env:LOCALAPPDATA\nvim"
$d_nvim = "$d_dir\nvim"
PathAndLink `
"$c_nvim\init.vim" `
"$d_nvim\init.vim"
PathAndLink `
"$c_nvim\colors" `
"$d_nvim\colors"
PathAndLink `
"$c_nvim\spell" `
"$d_nvim\spell"
# autohotkey
$c_ahk = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup"
$d_ahk = "$d_dir\ahk"
PathAndLink `
"$c_ahk\binds.ahk" `
"$d_ahk\binds.ahk"
# IntelliJ Idea
$c_intellij = "$HOME"
$d_intellij = "$d_dir\intellij"
PathAndLink `
"$c_intellij\.ideavimrc" `
"$d_intellij\.ideavimrc"