feat(pwsh): Windows Migration and optimize powershell scripts

This commit is contained in:
js0ny 2024-12-01 07:02:12 +00:00
parent 567c8d1b3b
commit 8306264bdb
12 changed files with 141 additions and 133 deletions

View file

@ -1,13 +1,16 @@
# $DOTFILES/tools\powershell\Aliases.ps1
# Date: 2024-12-01
# Author: contact@js0ny.net
# Aliases for PowerShell
### VARIABLES ###
$EDITOR = "code"
# Shell Equivalents #
Set-Alias "touch" "New-Item"
${function:ll} = { Get-ChildItem -Force }
${function:l} = { Get-ChildItem -Force }
${function:tree} = { lsd.exe --tree $args }
Set-Alias "which" "Get-Command"
# Shell Configurations #
${function:shcfg} = { code $PROFILE }
Set-Alias "pwshcfg" "shcfg"
${function:reload} = { . $PROFILE }
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
# Editors #
@ -16,31 +19,13 @@ Set-Alias "c" "code"
Set-Alias "gvi" "neovide"
# File Creation #
function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname }
function mkcd { param ( [string] $dirname) New-Item -ItemType Directory -Name $dirname && Set-Location $dirname }
function tc { param ( [string] $filename) New-Item $filename && code $filename }
function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
### Dev ###
# .NET #
${function:csi} = { dotnet repl --default-kernel csharp}
${function:fsi} = { dotnet repl --default-kernel fsharp}
# Python & Conda #
Set-Alias "py" "python"
Set-Alias "ipy" "ipython"
${function:pyact} = { conda activate $args[0] }
${function:pydact} = { conda deactivate }
${function:pylsenvs} = { conda env list }
${function:pymkenv} = { conda create --name $args[0] }
${function:pyrmenv} = { conda remove --name $args[0] --all }
# Winget #
if ($isWindows) {
${function:wini} = { winget install $args }
${function:winr} = { winget uninstall $args }
${function:wins} = { winget search $args }
${function:winu} = { winget upgrade $args }
}