docs: Add documentational comments

This commit is contained in:
js0ny 2025-01-28 14:24:30 +00:00
parent 1b050a13a8
commit 68ff1bb357
30 changed files with 732 additions and 562 deletions

View file

@ -4,45 +4,64 @@
# Set symlinks for dotfiles on Windows
# 在 Windows 上设置 配置文件的符号链接
# Run this with Administrator privileges
$DOTFILES = Join-Path $Env:UserProfile ".dotfiles"
$BASE_COMMON = Join-Path $DOTFILES "common"
$BASE_TOOLS = Join-Path $DOTFILES "tools"
$BASE_WIN = Join-Path $DOTFILES "platforms" "win"
$STARTUP = [System.Environment]::GetFolderPath("Startup")
$BAT_CONF = Join-Path $Env:AppData "bat" "config"
if ((Get-Command bat).Source -ccontains "scoop") {
$BAT_CONF = Join-Path (scoop prefix bat) "config"
}
$linkDots = @{
"$BASE_WIN\wslconfig" = "$Env:UserProfile\.wslconfig"
"$BASE_WIN\glzr" = "$Env:UserProfile\.glzr"
"$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml"
"$BASE_WIN\vsvimrc" = "$Env:UserProfile\.vsvimrc"
"$BASE_COMMON\bat.config" = "$BAT_CONF"
"$BASE_COMMON\condarc.yaml" = "$Env:XDG_CONFIG_HOME\conda\.condarc"
"$BASE_COMMON\gitconfig" = "$Env:UserProfile\.gitconfig"
"$BASE_COMMON\glow.yaml" = "$Env:AppData\glow\glow.yml"
"$BASE_COMMON\haskeline" = "$Env:UserProfile\.haskeline"
"$BASE_COMMON\ideavimrc" = "$Env:XDG_CONFIG_HOME\ideavim\ideavimrc"
"$BASE_COMMON\lazygit.yaml" = "$Env:AppData\lazygit\config.yml"
"$BASE_COMMON\lesskey" = "$Env:LessKeyIn"
"$BASE_COMMON\lsd" = "$Env:AppData\lsd\config.yaml"
"$BASE_COMMON\npmrc" = "$Env:NPM_CONFIG_USERCONFIG"
"$BASE_COMMON\NuGet.Config" = "$Env:AppData\NuGet\NuGet.Config"
"$BASE_COMMON\starship.toml" = "$Env:UserProfile\.config\starship.toml"
"$BASE_COMMON\pip.conf" = "$Env:AppData\pip\pip.ini"
"$BASE_COMMON\vimrc.noxdg.vimrc" = "$Env:UserProfile\_vimrc"
"$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR"
"$BASE_COMMON\emacs.d" = "$Env:AppData\.emacs.d"
"$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR"
"$BASE_TOOLS\nvim" = "$Env:XDG_CONFIG_HOME\nvim"
"$BASE_TOOLS\wezterm" = "$Env:XDG_CONFIG_HOME\wezterm"
"$BASE_TOOLS\yazi" = "$Env:AppData\yazi\config"
"$BASE_TOOLS\zed" = "$Env:AppData\Zed"
}
foreach ($target in $linkDots.Keys) {
$path = $linkDots[$target]
foreach ($src in $linkDots.Keys) {
$dest = $linkDots[$src]
# Auto create directories (Untested)
$dir = Split-Path $path
if (!(Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir -Force
if (Test-Path -Path $src -PathType Container) {
New-Item -ItemType Directory -Path $dest -Force
}
New-Item -ItemType SymbolicLink -Target $target -Path $path -Force
else {
$Local:destParent = Split-Path -Path $dest -Parent
New-Item -ItemType Directory -Path $destParent -Force
}
if (Test-Path -Path $dest) {
Move-Item $dest "$dest.bak" -Force
}
New-Item -ItemType SymbolicLink -Target $src -Path $dest -Force
}
New-Item -ItemType SymbolicLink -Target "$BASE_WIN\Microsoft.PowerShell_profile.ps1" -Path "$Env:UserProfile\Documents\PowerShell\Microsoft.PowerShell_profile.ps1" -Force
Copy-Item (Join-Path $BASE_WIN "ahk" "bin" "Caps.exe") $STARTUP
Copy-Item (Join-Path $BASE_COMMON "gitconfig") $Env:UserProfile