Skip to content

Instantly share code, notes, and snippets.

@tonesandtones
Last active February 10, 2023 08:41
Show Gist options
  • Save tonesandtones/ea12d8ec8ec0e7cda1a07a8ace512235 to your computer and use it in GitHub Desktop.
Save tonesandtones/ea12d8ec8ec0e7cda1a07a8ace512235 to your computer and use it in GitHub Desktop.
Tones' Oh-my-Posh PowerShell profile
#Tones' Oh-My-Posh Powershell profile
# One time setup: https://ohmyposh.dev/docs/installation/windows (or your OS of choice)
# Install-Module -Name Terminal-Icons -Repository PSGallery
Import-Module Terminal-Icons
oh-my-posh init pwsh --config "~/posh/.posh.tones.honukaiterm.json" | Invoke-Expression
# PowerShell parameter completion shim for the dotnet CLI
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
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 nuke -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
nuke :complete "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment