diff --git a/Documents/PowerShell/Microsoft.PowerShell_profile.ps1.tmpl b/Documents/PowerShell/Microsoft.PowerShell_profile.ps1.tmpl index 7362617..e2535ca 100644 --- a/Documents/PowerShell/Microsoft.PowerShell_profile.ps1.tmpl +++ b/Documents/PowerShell/Microsoft.PowerShell_profile.ps1.tmpl @@ -1,4 +1,6 @@ +{{ if eq .bash.prompt.type "oh-my-posh" }} oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\atomic.omp.json" | Invoke-Expression +{{ end }} function Get-LastN { param ( @@ -21,6 +23,20 @@ function Net-Cat() { Test-NetConnection -ComputerName $computerName -Port $port -InformationLevel Detailed } +# History with search +function hist { + $find = $args + Write-Host "Finding in full history using {`$_ -like `"*$find*`"}" + Get-Content (Get-PSReadlineOption).HistorySavePath | ? {$_ -like "*$find*"} | Get-Unique | more +} +# Reverse History Search +# Found at https://stackoverflow.com/questions/62883762/powershell-bind-arrow-keys-to-command-history-search +# +# Set-PSReadlineKeyHandler will list all mapped keys +Set-PSReadLineOption -HistorySearchCursorMovesToEnd +Set-PSReadlineKeyHandler -Key PageUp -Function HistorySearchBackward +Set-PSReadlineKeyHandler -Key PageDown -Function HistorySearchForward + # Navigate one directory up function Go-One-Level-Up { cd .. @@ -38,3 +54,12 @@ Set-Alias ... Go-Two-Levels-Up # More Aliases Set-Alias vi nvim Set-Alias vim nvim +Set-Alias ll dir + +function gg { + git graph +} + +{{ if eq .bash.prompt.type "starship" }} +Invoke-Expression (&starship init powershell) +{{ end }}