Switch to oh-my-posh.

This commit is contained in:
Bartek Stalewski 2024-06-24 15:20:23 +02:00
parent 27b42564b7
commit da19c0a6c9
No known key found for this signature in database
3 changed files with 88 additions and 2 deletions

85
config/omp/omp.toml Normal file
View file

@ -0,0 +1,85 @@
'$schema' = 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json'
final_space = true
version = 2
[[blocks]]
type = 'prompt'
alignment = 'left'
[[blocks.segments]]
type = 'python'
style = 'plain'
background = 'transparent'
foreground = '15'
template = ' {{ .Venv }} '
[blocks.segments.properties]
home_enabled = true
[[blocks.segments]]
type = 'session'
style = 'plain'
background = 'transparent'
foreground_templates = [
"{{ if .Root }}196{{ end }}",
]
template = '{{ if or (.SSHSession) (.Root) }}{{ .UserName }}@{{ .HostName }} {{ end }}'
[[blocks.segments]]
type = 'path'
style = 'plain'
background = 'transparent'
foreground = '37'
template = '{{ if not .Writable }} {{ end }}{{ .Path }} '
[blocks.segments.properties]
style = 'full'
[[blocks.segments]]
type = 'git'
style = 'plain'
background = 'transparent'
foreground = '246'
template = '{{ .HEAD }}<red>{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }}</> <green>{{ if gt .Behind 0 }}⇣{{ end }}{{ if gt .Ahead 0 }}⇡{{ end }}{{ if gt .StashCount 0 }}≡ {{ end }}</>'
[blocks.segments.properties]
branch_icon = ' '
commit_icon = '@'
fetch_status = true
[[blocks.segments]]
type = 'text'
style = 'plain'
background = 'transparent'
foreground_templates = [
'{{ if eq .Code 0 }}76{{ end }}',
'{{ if gt .Code 0 }}196{{ end }}',
]
template = ''
[transient_prompt]
background = 'transparent'
foreground_templates = [
'{{ if eq .Code 0 }}76{{ end }}',
'{{ if gt .Code 0 }}196{{ end }}',
]
template = ' '
[secondary_prompt]
background = 'transparent'
foreground = '220'
template = ' '
[[blocks]]
type = 'rprompt'
overflow = 'hidden'
[[blocks.segments]]
type = 'executiontime'
style = 'plain'
background = 'transparent'
foreground = '220'
[blocks.segments.properties]
style = 'round'
threshold = 3000

View file

@ -1,70 +0,0 @@
add_newline = false
format="""
$python\
$username\
$hostname\
$directory\
$git_branch\
$git_status\
$jobs\
$character
"""
right_format="""
$cmd_duration
"""
[python]
format = '[(${symbol} $virtualenv)]($style) '
style = '15'
symbol = ''
[username]
format = '[$user]($style)'
style_user = 'normal'
style_root = 'bold 196'
show_always = true
[hostname]
format = '([@$hostname]($style))'
style = 'normal'
[directory]
format = '[ ($read_only )]($read_only_style)[$path]($style) '
style = '37'
read_only_style = '37'
read_only = ''
truncation_length = 0
[git_state]
format = '\([$state( $progress_current/$progress_total)]($style)\) '
style = 'bright-black'
[git_branch]
format = '[$symbol$branch]($style)'
style = '246'
symbol = ' '
[git_status]
format = '[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218)($ahead_behind$stashed) ]($style)'
style = 'green'
conflicted = ''
untracked = ''
modified = ''
staged = ''
renamed = ''
deleted = ''
stashed = '≡'
[jobs]
style = '70'
symbol = '⇶'
[character]
success_symbol = '[](76)'
error_symbol = '[](196)'
[cmd_duration]
format = '[$duration]($style)'
style = '220'

View file

@ -39,8 +39,9 @@ if [[ $(command -v vivid) ]]; then
else
unset LS_COLORS
fi
export STARSHIP_CACHE="$XDG_CACHE_HOME"/starship
eval "$(STARSHIP_CACHE="$XDG_CACHE_HOME"/starship starship init zsh)"
if [ "$TERM_PROGRAM" != "Apple_Terminal" ]; then
eval "$(oh-my-posh --config ${XDG_CONFIG_HOME}/omp/omp.toml init zsh)"
fi
# completion
zstyle ':completion:*' menu select