Created
November 5, 2021 05:43
-
-
Save goncharenko/7ae61265dfbda48a1b5c80d9cc45d399 to your computer and use it in GitHub Desktop.
PowerShell Profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($host.Name -eq 'ConsoleHost') { | |
Import-Module PSReadLine | |
} | |
oh-my-posh --init --shell pwsh --config C:\Users\vitaly.goncharenko\scoop\apps\oh-my-posh\current\themes\spaceship.omp.json | Invoke-Expression | |
Import-Module -Name Terminal-Icons | |
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock { | |
param($wordToComplete, $commandAst, $cursorPosition) | |
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new() | |
$Local:word = $wordToComplete.Replace('"', '""') | |
$Local:ast = $commandAst.ToString().Replace('"', '""') | |
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object { | |
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) | |
} | |
} | |
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock { | |
param($commandName, $wordToComplete, $cursorPosition) | |
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object { | |
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) | |
} | |
} | |
Set-PSReadLineOption -PredictionSource History | |
Set-PSReadLineOption -EditMode Windows | |
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward | |
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment