dofiles-win/Documents/PowerShell/aliases.ps1

63 lines
1.3 KiB
PowerShell
Raw Normal View History

2024-02-03 16:17:24 -04:00
# Unix like pwd
if (Test-Path alias:pwd) {
2024-02-15 16:46:44 -04:00
Remove-Alias -Name pwd
}
Function pwd { (Get-Location).Path }
2024-02-03 16:17:24 -04:00
2024-02-15 16:46:44 -04:00
# Change to dotfiles directory
if (Test-Path alias:dotfolder) {
Remove-Alias -Name dotfolder
}
Function dotfolder { Set-Location ~/.local/share/chezmoi }
if (Test-Path alias:dotcommit) {
Remove-Alias -Name dotcommit
}
2024-02-03 16:17:24 -04:00
2024-02-15 16:46:44 -04:00
Function dotcommit {
# Export installed apps to file
. ~/Documents/PowerShell/installed-apps.ps1
# If no arguments are passed, use the default message
if ($args.Length -eq 0) {
$message = "Update dotfiles"
}
else {
$message = $args -join " "
2024-02-03 16:17:24 -04:00
}
2024-02-15 16:46:44 -04:00
chezmoi re-add
chezmoi diff
chezmoi git -- commit -a -m $message
chezmoi git -- push
chezmoi apply
}
2024-02-03 16:17:24 -04:00
2024-02-15 16:46:44 -04:00
# Replace cat with bat
if (Test-Path alias:cat) {
Remove-Alias -Name cat
}
Set-Alias -Name cat -Value bat
2024-02-07 17:56:23 -04:00
2024-02-15 16:46:44 -04:00
# Replace ls with exa
if (Test-Path alias:ls) {
Remove-Alias -Name ls
}
2024-02-15 16:58:41 -04:00
Set-Alias -Name ls -Value exa
# Replace cd with zoxide
if (Test-Path alias:cd) {
Remove-Alias -Name cd
}
2024-02-15 17:02:50 -04:00
Set-Alias -Name cd -Value z
2024-02-15 16:58:41 -04:00
# Replace grep with ugrep
if (Test-Path alias:grep) {
Remove-Alias -Name grep
}
Set-Alias -Name grep -Value ugrep
# Add alias for recycle-bin
if (Test-Path alias:rb) {
Remove-Alias -Name rb
}
Set-Alias -Name rb -Value recycle-bin