Skip to content

Instantly share code, notes, and snippets.

@tompazourek
Last active September 12, 2020 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tompazourek/454a75c85be03dfa2a135a71ef036887 to your computer and use it in GitHub Desktop.
Save tompazourek/454a75c85be03dfa2a135a71ef036887 to your computer and use it in GitHub Desktop.
PS profile
#requires -Version 2 -Modules posh-git
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
#check for elevated prompt
If (Test-Administrator) {
$prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol)"
}
# Writes the drive portion
$prompt += Write-Prompt -Object "$(Get-ShortPath -dir $pwd)" -ForegroundColor Blue
#$prompt += [char]::ConvertFromUtf32(0x000002728)
$prompt += Write-Prompt -Object "$ " -ForegroundColor White
$prompt
}
$sl = $global:ThemeSettings #local settings
$env:LC_ALL='C.UTF-8'; # fixes Git's output to be unicode
Import-Module oh-my-posh;
Set-Theme CustomTheme;
Set-Alias -Name sublime -Value "C:\Program Files\Sublime Text 3\sublime_text.exe"
Register-ArgumentCompleter -Native -CommandName nuke -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
nuke :complete "$wordToComplete" | Where-Object {
!$_.StartsWith('NUKE Global Tool version')
} | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
# dotnet suggest shell start
$availableToComplete = (dotnet-suggest list) | Out-String
$availableToCompleteArray = $availableToComplete.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries)
Register-ArgumentCompleter -Native -CommandName $availableToCompleteArray -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
$fullpath = (Get-Command $wordToComplete.CommandElements[0]).Source
$arguments = $wordToComplete.Extent.ToString().Replace('"', '\"')
dotnet-suggest get -e $fullpath --position $cursorPosition -- "$arguments" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
$env:DOTNET_SUGGEST_SCRIPT_VERSION = "1.0.0"
# dotnet suggest script end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment