zsh
# .sh
alias rebasep='git pull --rebase upstream main'
alias rebasec='git rebase --continue'
alias rebase='RUN() { git rebase -i HEAD~$1; }; RUN'
alias gdiff='git diff --name-only --diff-filter=U'
alias gdrop='git branch | grep -v "master" | xargs git branch -D '
PowerShell 7
# Microsoft.PowerShell_profile.ps1
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme jandedobbeleer
Set-PSReadLineOption -PredictionSource History
Set-PSReadlineKeyHandler -Key Tab -Function Complete
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Function CD01 {
git diff --name-only --diff-filter=U
}
Set-Alias -Name gdiff -Value CD01
Function CD02([string]$Step)
{
git rebase -i HEAD~$Step
}
Set-Alias -Name rebase -Value CD02
Function CD03([string]$pattern, [string]$path)
{
Get-ChildItem -path $path -Recurse | Select-String -Pattern "$pattern" -CaseSensitive
}
Set-Alias -Name grep -Value CD03
Function CD04([string]$url)
{
[string]$filename = Split-Path ([uri]$url).LocalPath -leaf
[string]$_pwd = Get-Location
[string]$save_path = "$_pwd\$filename"
echo $url
echo $save_path
Invoke-WebRequest $url -OutFile $save_path
}
Set-Alias -Name wget -Value CD04
PowerShell 5
Invoke-Expression (&starship init powershell)
Set-PSReadLineOption -PredictionSource History
Set-PSReadlineKeyHandler -Key Tab -Function Complete
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Function CD01 {
git diff --name-only --diff-filter=U
}
Set-Alias -Name gdiff -Value CD01
Function CD02([string]$Step)
{
git rebase -i HEAD~$Step
}
Set-Alias -Name rebase -Value CD02
Function CD03([string]$pattern, [string]$path)
{
Get-ChildItem -path $path -Recurse | Select-String -Pattern "$pattern" -CaseSensitive
}
Set-Alias -Name grep -Value CD03
Function CD04([string]$url)
{
[string]$filename = Split-Path ([uri]$url).LocalPath -leaf
[string]$_pwd = Get-Location
[string]$save_path = "$_pwd\$filename"
Write-Output $url
Write-Output $save_path
Invoke-WebRequest $url -OutFile $save_path
}
Set-Alias -Name wget -Value CD04 -Option AllScope