From e0000b5c5935b87a03791359707ada5797f472f9 Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 27 May 2024 17:26:28 +0200 Subject: Add Microsoft.PowerShell_profile.ps1 --- .../powershell/Microsoft.PowerShell_profile.ps1 | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .config/powershell/Microsoft.PowerShell_profile.ps1 (limited to '.config/powershell') diff --git a/.config/powershell/Microsoft.PowerShell_profile.ps1 b/.config/powershell/Microsoft.PowerShell_profile.ps1 new file mode 100644 index 0000000..cebfeb1 --- /dev/null +++ b/.config/powershell/Microsoft.PowerShell_profile.ps1 @@ -0,0 +1,48 @@ +# THIS IS NEEDED FOR GIT TAB COMPLETION +Import-Module posh-git + +# Set-PoshPrompt -Theme Paradox +# Set-PoshPrompt -Theme ~/.mytheme.tokyonight.omp.yaml +# Set-PoshPrompt -Theme ~/.omp/themes/tokyonight.omp.yaml +oh-my-posh init pwsh --config ~/.omp/themes/tokyonight.omp.yaml | Invoke-Expression + +# Chocolatey profile +$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" +if (Test-Path($ChocolateyProfile)) { + Import-Module "$ChocolateyProfile" +} + +# PSReadLine extension to provide VI keybindings +Set-PSReadlineOption -EditMode vi +Set-PSReadLineKeyHandler -Key Tab -Function Complete +Set-PSReadLineKeyHandler -Key Ctrl+r -Function ReverseSearchHistory + +# Remove gl, gp, gm aliases for git commands +Remove-Alias -Force -Name gl +Remove-Alias -Force -Name gp +Remove-Alias -Force -Name gm + +function gs { git status } +function gf { git fetch } +function gl { git pull } +function gp { git push } +function gpt { git push --tags } +function gP { git push --force-with-lease } +function ga { git add } +function gcam { git commit -am } +function gd { git diff } +function gw { git diff --word-diff } +function glog { git logo } +function gdog { git dog } +function gadog { git adog } +function gb { git branch } +function gba { git branch --all } +function gco { git checkout } +function gm { git merge } + +# For zoxide v0.8.0+ +Invoke-Expression (& { + $hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' } + (zoxide init --hook $hook powershell | Out-String) +}) + -- cgit v1.2.3