Skip to content

Instantly share code, notes, and snippets.

@ladeak
Last active December 30, 2022 14:20
Show Gist options
  • Save ladeak/03f07a9aae2cded064bfac6ce47f0192 to your computer and use it in GitHub Desktop.
Save ladeak/03f07a9aae2cded064bfac6ce47f0192 to your computer and use it in GitHub Desktop.
Terminal
https://www.nerdfonts.com/font-downloads
CaskaydiaCode Nerd Font
Set-PoshPrompt -Theme ladeak-posh-theme
Import-Module -Name Terminal-Icons
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
# dotnet suggest shell start
if (Get-Command "dotnet-suggest" -errorAction SilentlyContinue)
{
$availableToComplete = (dotnet-suggest list) | Out-String
$availableToCompleteArray = $availableToComplete.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries)
Register-ArgumentCompleter -Native -CommandName $availableToCompleteArray -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$fullpath = (Get-Command $commandAst.CommandElements[0]).Source
$arguments = $commandAst.Extent.ToString().Replace('"', '\"')
dotnet-suggest get -e $fullpath --position $cursorPosition -- "$arguments" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
}
else
{
"Unable to provide System.CommandLine tab completion support unless the [dotnet-suggest] tool is first installed."
"See the following for tool installation: https://www.nuget.org/packages/dotnet-suggest"
}
$env:DOTNET_SUGGEST_SCRIPT_VERSION = "1.0.2"
# dotnet suggest script end
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"horizontal_offset": 0,
"segments": [ {
"background": "#feae34",
"foreground": "#262b44",
"leading_diamond": "",
"powerline_symbol": "",
"properties": {
"prefix": "  ",
"style": "full"
},
"style": "diamond",
"trailing_diamond": "",
"type": "path"
},
{
"background": "#fee761",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#f77622{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#e43b44{{ end }}",
"{{ if gt .Ahead 0 }}#2ce8f5{{ end }}",
"{{ if gt .Behind 0 }}#f77622{{ end }}"
],
"foreground": "#262b44",
"powerline_symbol": "",
"properties": {
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true,
"template": "{{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }}"
},
"style": "powerline",
"type": "git"
},
{
"background": "#fee761",
"foreground": "#262b44",
"powerline_symbol": "",
"style": "powerline",
"type": "root"
}
],
"type": "prompt",
"vertical_offset": 0
}
],
"final_space": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment