Skip to content

Instantly share code, notes, and snippets.

@zawupf
Last active April 2, 2024 07:38
Show Gist options
  • Save zawupf/ba05ff1f442db0dbe9b52d5fb46abdb9 to your computer and use it in GitHub Desktop.
Save zawupf/ba05ff1f442db0dbe9b52d5fb46abdb9 to your computer and use it in GitHub Desktop.
My powershell profile
if ($PSEdition -eq 'Core') {
# Newer cross-platform pwsh
$env:PAGER = 'less.exe'
}
else {
# Older windows only powershell
Set-Alias -Name more -Value less
}
# Fix issue with dotnet SDK 7.0.302
$env:DOTNET_CLI_UI_LANGUAGE = "en-US"
# Fix pagers (less/more) encoding issues
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
# Quick access to git-bash and vim
Set-Alias -Name sh -Value "$HOME\scoop\apps\git-with-openssh\current\bin\bash.exe"
function Open-Vim ([string]$filepath) {
sh -c "vim '$filepath'"
}
Set-Alias -Name vim -Value "Open-Vim"
# PowerShell parameter completion shim for the dotnet CLI
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
dotnet complete --position $cursorPosition "$commandAst" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
# Pimp prompt
Invoke-Expression (&starship init powershell)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment