-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSetup.ps1
More file actions
107 lines (93 loc) · 4.61 KB
/
Setup.ps1
File metadata and controls
107 lines (93 loc) · 4.61 KB
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
#!/usr/bin/env -S pwsh -nop
if (!($IsWindows -or $PSVersionTable.PSVersion.Major -le 5)) { exit 1 }
$DotDir = "$Env:UserProfile\GitHub\rashil2000\dotfiles"
$DocDir = [Environment]::GetFolderPath('MyDocuments')
$dryrun = $true
# Setup Scoop
if (!(Get-Command scoop -ErrorAction Ignore)) {
if ($Env:SCOOP) { Write-Host "Installing Scoop to $Env:SCOOP..." }
Invoke-RestMethod get.scoop.sh | Invoke-Expression
}
# Install apps
scoop bucket add extras
scoop install starship autohotkey fd ripgrep bat bottom yazi spotify-player delta python fzf gdu gh gsudo clangd clink clink-completions busybox-lean nodejs-lts
scoop install https://raw.githubusercontent.com/ScoopInstaller/Versions/refs/heads/master/bucket/neovim-nightly.json
scoop install https://raw.githubusercontent.com/ScoopInstaller/Versions/refs/heads/master/bucket/wezterm-nightly.json
# Download dotfiles
if (!(Test-Path $DotDir)) {
New-Item $DotDir -ItemType Directory -Force -WhatIf:$dryrun
if (Get-Command git -ErrorAction Ignore) {
git clone https://github.com/rashil2000/dotfiles $DotDir
} else {
Write-Warning "Git not found"
exit 1
}
}
# Setup configuration files
@{
"$Env:AppData\bottom\bottom.toml" = "$DotDir\bottom\bottom.toml"
"$Env:AppData\yazi\config" = "$DotDir\yazi"
"$Env:AppData\bat" = "$DotDir\bat"
"$Env:LocalAppData\clink\.inputrc" = "$DotDir\.inputrc"
"$Env:LocalAppData\clink\clink_settings" = "$DotDir\cmd\clink_settings"
"$Env:LocalAppData\clink\clink_start.cmd" = "$DotDir\cmd\clink_start.cmd"
"$Env:LocalAppData\nvim" = "$DotDir\nvim"
# "$Env:UserProfile\.bashrc" = "$DotDir\bash\.bashrc"
"$Env:UserProfile\.config\wezterm" = "$DotDir\wezterm"
"$Env:UserProfile\.config\git\config" = "$DotDir\git\config"
"$Env:UserProfile\.config\starship.toml" = "$DotDir\starship\starship.toml"
"$Env:UserProfile\.config\tmux\tmux.conf" = "$DotDir\tmux\tmux.conf"
"$Env:UserProfile\.config\spotify-player\app.toml" = "$DotDir\spotify-player\app.toml"
"$DocDir\PowerShell\coc.vim_profile.ps1" = "$DotDir\pwsh\Microsoft.PowerShell_profile.ps1"
"$DocDir\PowerShell\Microsoft.PowerShell_profile.ps1" = "$DotDir\pwsh\Microsoft.PowerShell_profile.ps1"
"$DocDir\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" = "$DotDir\pwsh\Microsoft.PowerShell_profile.ps1"
}.GetEnumerator() | ForEach-Object {
# Check symbolic link health
if ((Test-Path $_.Name) `
-and ((Get-Item $_.Name).LinkType -eq 'SymbolicLink') `
-and ((Get-Item $_.Name).Target -eq $_.Value)) {
continue
}
# Check parent directory
if (!(Test-Path (Split-Path $_.Name))) {
New-Item (Split-Path $_.Name) -ItemType Directory -Force -WhatIf:$dryrun
}
New-Item -Type SymbolicLink $_.Name -Target $_.Value -Force -WhatIf:$dryrun
}
@{
# "$Env:UserProfile\.profile" = "$DotDir\bash\.profile"
"$DocDir\PowerShell\Profile.ps1" = "$DotDir\pwsh\profile.ps1"
"$DocDir\WindowsPowerShell\Profile.ps1" = "$DotDir\pwsh\profile.ps1"
}.GetEnumerator() | ForEach-Object {
if (!(Test-Path $_.Name)) {
Copy-Item $_.Value $_.Name -WhatIf:$dryrun
}
}
# Setup Starship
if (Get-Command starship -ErrorAction Ignore) {
if (!(Test-Path "$Env:UserProfile\.local\share")) {
New-Item "$Env:UserProfile\.local\share" -ItemType Directory -Force -WhatIf:$dryrun
}
if (!(Test-Path "$Env:UserProfile\.local\share\starship.ps1")) {
starship init powershell --print-full-init | Out-File "$Env:UserProfile\.local\share\starship.ps1" -WhatIf:$dryrun
}
if (!(Test-Path "$Env:LocalAppData\clink\starship.lua")) {
starship init cmd | Out-File "$Env:LocalAppData\clink\starship.lua" -WhatIf:$dryrun
}
}
# Random
if (Get-Command npm -ErrorAction Ignore) {
npm install -g neovim markserv
}
if (Get-Command pip -ErrorAction Ignore) {
pip install pynvim wheel pipdeptree
pip install git+https://github.com/imba-tjd/pip-autoremove@ups
}
if (Get-Command clink -ErrorAction Ignore) {
$scoopdir = if ($Env:SCOOP) { $Env:SCOOP } else { "$Env:UserProfile\Scoop" }
clink autorun set "\`"$scoopdir\apps\clink\current\clink.bat\`" inject --autorun --quiet"
}
if (Get-Command ya -ErrorAction Ignore) {
ya pkg add yazi-rs/plugins:mime-ext
ya pkg add yazi-rs/plugins:toggle-pane
}