Skip to content

Instantly share code, notes, and snippets.

@JohnLudlow
Last active December 15, 2023 14:43
Show Gist options
  • Save JohnLudlow/a304a96c5ab1c4a193def088becba816 to your computer and use it in GitHub Desktop.
Save JohnLudlow/a304a96c5ab1c4a193def088becba816 to your computer and use it in GitHub Desktop.
Prompt config
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
"$schema": https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
palette:
left_header_bg: "#898989"
left_header_fg: "#000000"
path_bg: "#656565"
path_fg: "#dfdfdf"
git_steady_bg : "#454545"
git_steady_fg : "#ffffff"
git_nosync_bg : "#B388FF"
git_nosync_fg : "#800080"
git_change_bg : "#ffd810"
git_change_fg : "#000000"
aws_account_bg: "#ec7211"
aws_account_fg: "#ffffff"
project_bg: "#f8f8f8"
project_fg: "#000000"
node_bg: "#87bf00"
node_fg: "#2E4200"
dotnet_bg: "#6cf7f7"
dotnet_fg: "#000000"
batt_full_bg: "#99CC99"
batt_full_fg: "#668866"
batt_chrg_bg: "#99CC99"
batt_chrg_fg: "#668866"
batt_drng_bg: "#CC8400"
batt_drng_fg: "#faf3e7"
exec_time_bg: "#ec4b4b"
exec_time_fg: "#020202"
cmd_fail_bg: "#590000"
cmd_succ_bg: "#008000"
cmd_fg : "#fbfbfb"
sess_bg: "#898989"
sess_fg: "#000000"
clock_bg: "#454545"
clock_fg: "#f6f6f6"
blocks:
- type: prompt
alignment: left
segments:
#################
#
# left header #1
#
# Left decoration, OS, root, shell
#
#################
- type: os
template: "{{ if .WSL }}WSL{{ end }}{{ .Icon }} "
background: "p:left_header_bg"
foreground: "p:left_header_fg"
style: diamond
leading_diamond: "╭─"
- type: shell
template: "{{ if .WSL }}{{ .Name }}{{ end }}"
background: "parentBackground"
foreground: "parentForeground"
style: plain
- type: root
template: ""
background: "parentBackground"
foreground: "parentForeground"
style: plain
- type: text
template: ""
background: "p:path_bg"
foreground: "parentBackground"
style: plain
#################
#
# Path
#
#################
- type: path
properties:
style: letter
template: " {{ .Path }}"
background: "p:path_bg"
foreground: "p:path_fg"
style: diamond
trailing_diamond: ""
#################
#
# Git
#
#################
- type: git
properties:
fetch_status: true
templates:
- "{{ .UpstreamIcon }} <b>{{ abbrev 20 .HEAD }}</b>@<b>{{ abbrev 10 .LatestTag }}</b>#<b>{{ trunc 8 .Commit.Sha }} </b>"
- "{{ if or (gt .Ahead 0) (gt .Behind 0) }}<p:git_nosync_fg><r>{{ .BranchStatus }}</r></>{{ end }}"
- "{{ if .Working.Changed }}<r> {{ .Working.String }}</r>{{ end }}"
- "{{ if .Staging.Changed }}<r> {{ .Staging.String }}</r>{{ end }}"
- "{{ if gt .StashCount 0 }}<r> {{ .StashCount }}</r>{{ end }}"
background_templates:
- "{{ if or (.Working.Changed) (.Staging.Changed) }}p:git_change_bg{{ end }}"
- "{{ if gt .Ahead 0 }}p:git_nosync_bg{{ end }}"
- "{{ if gt .Behind 0 }}p:git_nosync_bg{{ end }}"
foreground_templates:
- "{{ if or (.Working.Changed) (.Staging.Changed) }}p:git_change_fg{{ end }}"
- "{{ if gt .Ahead 0 }}p:git_nosync_fg{{ end }}"
- "{{ if gt .Behind 0 }}p:git_nosync_fg{{ end }}"
background: "p:git_steady_bg"
foreground: "p:git_steady_fg"
style: diamond
trailing_diamond: ""
#################
#
# Info block
#
# AWS, project, dotnet, battery
#
#################
- type: aws
template: " AWS:<b>{{.Profile}}</b>{{if .Region}}@{{.Region}}{{end}}"
background: "p:aws_account_bg"
foreground: "p:aws_account_fg"
style: diamond
trailing_diamond: ""
# - type: project
# background: "p:project_bg"
# foreground: "p:project_fg"
# style: diamond
# trailing_diamond: ""
- type: node
template: " <b> {{ .Full }}</b>"
background: "p:node_bg"
foreground: "p:node_fg"
style: diamond
trailing_diamond: ""
- type: dotnet
template: " <b> {{ .Full }}<b>"
background: "p:dotnet_bg"
foreground: "p:dotnet_fg"
style: diamond
trailing_diamond: ""
- type: battery
properties:
charged_icon: " "
charging_icon: " "
discharging_icon: " "
template: '{{ if lt .Percentage 80 }} {{.Icon}} {{.Percentage}}{{ end }}'
background_templates:
- '{{ if eq .State.String "Full" }}p:batt_full_bg{{ end }}'
- '{{ if eq .State.String "Charging" }}p:batt_chrg_bg{{ end }}'
- '{{ if eq .State.String "Discharging" }}p:batt_drng_bg{{ end }}'
foreground_templates:
- '{{ if eq .State.String "Full" }}p:batt_full_fg{{ end }}'
- '{{ if eq .State.String "Charging" }}p:batt_chrg_fg{{ end }}'
- '{{ if eq .State.String "Discharging" }}p:batt_drng_fg{{ end }}'
background: "p:batt_drng_bg"
foreground: "p:batt_drng_fg"
style: diamond
trailing_diamond: ""
#################
#
# Command status block
#
# Execution time, status
#
#################
- type: executiontime
properties:
style: austin
threshold: 500
template: " {{ .FormattedMs }}"
background: "p:exec_time_bg"
foreground: "p:exec_time_fg"
style: diamond
trailing_diamond: ""
- type: status
properties:
always_enabled: true
display_exit_code: true
template: "{{ if gt .Code 0 }}  {{ reason .Code }} ({{.Code}}){{ end }} "
background_templates:
- "{{ if gt .Code 0 }}p:cmd_fail_bg{{ end }}"
background: "p:cmd_succ_bg"
foreground: "p:cmd_fg"
style: diamond
trailing_diamond: ""
- type: prompt
alignment: right
segments:
#################
#
# right header #1
#
# Session user and machine name, time
#
#################
# - type: session
# template: "{{ if .SSHSession }} {{ end }}{{ .UserName }}@{{ .HostName }}<#fb7e14></>"
# background: "p:sess_bg"
# foreground: "p:sess_fg"
# leading_diamond: ""
# trailing_diamond: ""
# style: diamond
- type: time
properties:
time_format:  15:04:05  _2
template: "{{ .CurrentDate | date .Format }}"
background: "p:clock_bg"
foreground: "p:clock_fg"
leading_diamond: ""
trailing_diamond: ""
style: diamond
- type: prompt
alignment: left
newline: true
segments:
#################
#
# Prompt
#
#################
- type: text
template: "╰"
background: transparent
foreground: "p:left_header_bg"
style: diamond
valid_line:
background: transparent
foreground: "p:left_header_bg"
template: " "
error_line:
background: transparent
foreground: "#ff0000"
template: " "
console_title_template: "{{.PWD}}"
final_space: true
version: 2
# $PSStyle.Formatting.FormatAccent = "`e[32m"
# $PSStyle.Formatting.TableHeader = "`e[36m"
# $PSStyle.FileInfo.Directory = "`e[34m"
$env:POSH_GIT_ENABLED = $true
Import-Module historypx
Import-Module Terminal-Icons
Import-Module posh-git
function Find-InstalledCommand {
[CmdletBinding()]
[OutputType([PSModuleInfo])]
param (
[Parameter()]
[string]$CommandNameFragment
)
Get-Module -All -ListAvailable | Where-Object {
($_ | Select-Object -ExpandProperty ExportedCommands).Keys -like "*$CommandNameFragment*"
}
}
Set-Alias fcm Find-Command
Set-Alias ficm Find-InstalledCommand
# Set-TerminalIconsTheme -ColorTheme devblackops_light
Set-PSReadLineOption -PredictionViewStyle ListView -PredictionSource HistoryAndPlugin -Colors @{
"Parameter" = "`e[44;30m"
}
if (posh-git\Get-GitDirectory)
{
onefetch
}
oh-my-posh init pwsh --config $env:HOMEDRIVE\$env:HOMEPATH\themes\jl.omp.yaml | Invoke-Expression
Enable-PoshLineError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment