From 6d8603f31f9a8171a87f583b75512a296b10376c Mon Sep 17 00:00:00 2001 From: reeink Date: Thu, 7 Mar 2024 22:13:43 +0800 Subject: [PATCH] add windows config --- .chezmoiignore | 8 ++++++ .../Microsoft.PowerShell_profile.ps1 | 25 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Documents/PowerShell/Microsoft.PowerShell_profile.ps1 diff --git a/.chezmoiignore b/.chezmoiignore index b43bf86..493dfff 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -1 +1,9 @@ README.md + +{{ if ne .chezmoi.os "windows" }} +Documents +{{ end }} + +{{ if ne .chezmoi.os "linux" }} +.zshrc +{{ end }} diff --git a/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 b/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 new file mode 100644 index 0000000..cdcff19 --- /dev/null +++ b/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 @@ -0,0 +1,25 @@ +# init +Invoke-Expression (&starship init powershell) # starship + +# micromamba +#region mamba initialize +# !! Contents within this block are managed by 'mamba shell init' !! +$Env:MAMBA_ROOT_PREFIX = "C:\Users\remon\.micromamba" +$Env:MAMBA_EXE = "C:\Users\remon\AppData\Local\micromamba\micromamba.exe" +(& $Env:MAMBA_EXE 'shell' 'hook' -s 'powershell' -p $Env:MAMBA_ROOT_PREFIX) | Out-String | Invoke-Expression +#endregion + +# Alias +Set-Alias -Name ls -Value eza +Set-Alias -Name mm -Value micromamba +Set-Alias -Name dotfiles -Value chezmoi + +function ya { + $tmp = [System.IO.Path]::GetTempFileName() + yazi $args --cwd-file="$tmp" + $cwd = Get-Content -Path $tmp + if (-not [String]::IsNullOrEmpty($cwd) -and $cwd -ne $PWD.Path) { + Set-Location -Path $cwd + } + Remove-Item -Path $tmp +}