Skip to content

Instantly share code, notes, and snippets.

@trippwill
Created December 9, 2019 16:57
Show Gist options
  • Save trippwill/5bf0551998e89f5309254acb9a36ecf0 to your computer and use it in GitHub Desktop.
Save trippwill/5bf0551998e89f5309254acb9a36ecf0 to your computer and use it in GitHub Desktop.
PowerShell Core Profile
### Customize Prompt for Visual Studio Developer PowerShell
# Get the current prompt
$defaultPrompt = (Get-Item function:prompt).ScriptBlock
# Setup the custom prompt
function prompt {
$pr = if (Test-Path env:/VSINSTALLDIR) { "[VS $env:VisualStudioVersion]:" }
else {''}
Write-Host $pr -NoNewline -ForegroundColor DarkMagenta
Write-Host ' ' -NoNewline
$defaultPrompt.Invoke()
}
### Aliases
Set-Alias g git -Option AllScope -Scope Global
### dotnet
# 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', $_)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment