Switch to oh-my-posh prompt

This commit is contained in:
Jonny Barnes 2024-06-10 20:37:31 +01:00
parent a97e471021
commit 8e6dffbd9b
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
4 changed files with 97 additions and 9 deletions

View file

@ -16,6 +16,7 @@ test -d $HOME/.ncmpcpp || mkdir $HOME/.ncmpcpp
test -L $HOME/.ncmpcpp/config || ln -f -s $BASEDIR/ncmpcpp $HOME/.ncmpcpp/config test -L $HOME/.ncmpcpp/config || ln -f -s $BASEDIR/ncmpcpp $HOME/.ncmpcpp/config
test -L $HOME/.tmux.conf || ln -f -s $BASEDIR/tmux $HOME/.tmux.conf test -L $HOME/.tmux.conf || ln -f -s $BASEDIR/tmux $HOME/.tmux.conf
test -L $HOME/.config/starship.toml || ln -f -s $BASEDIR/starship.toml $HOME/.config/starship.toml test -L $HOME/.config/starship.toml || ln -f -s $BASEDIR/starship.toml $HOME/.config/starship.toml
test -L $HOME/.config/jmb.omp.toml || ln -f -s $BASEDIR/jmb.omp.toml $HOME/.config/jmb.omp.toml
test -d $HOME/.sheldon || mkdir $HOME/.sheldon test -d $HOME/.sheldon || mkdir $HOME/.sheldon
test -L $HOME/.sheldon/plugins.toml || ln -f -s $BASEDIR/sheldon.toml $HOME/.sheldon/plugins.toml test -L $HOME/.sheldon/plugins.toml || ln -f -s $BASEDIR/sheldon.toml $HOME/.sheldon/plugins.toml
test -L $HOME/.zsh || ln -f -s $BASEDIR/zsh $HOME/.zsh test -L $HOME/.zsh || ln -f -s $BASEDIR/zsh $HOME/.zsh

88
jmb.omp.toml Normal file
View file

@ -0,0 +1,88 @@
#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
version = 2
console_title_template = '{{ .Folder }}'
[[blocks]]
type = 'prompt'
alignment = 'left'
[[blocks.segments]]
type = 'os'
style = 'diamond'
powerline_symbol = ''
foreground = '#ffffff'
background = '#546e7a'
leading_diamond = ''
template = '{{.Icon}} '
[[blocks.segments]]
type = 'path'
style = 'powerline'
powerline_symbol = ''
foreground = '#ffffff'
background = '#0080ff'
template = '  {{ .Path }} '
[blocks.segments.properties]
style = 'full'
[[blocks.segments]]
type = 'git'
style = 'powerline'
powerline_symbol = ''
foreground = '#000000'
background = '#c19c00'
background_templates = ['{{ if or (.Working.Changed) (.Staging.Changed) }}#FFEB3B{{ end }}', '{{ if and (gt .Ahead 0) (gt .Behind 0) }}#FFA300{{ end }}', '{{ if gt .Ahead 0 }}#FF7070{{ end }}', '{{ if gt .Behind 0 }}#90F090{{ end }}']
template = ' {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }} '
[blocks.segments.properties]
fetch_stash_count = true
fetch_status = true
fetch_upstream_icon = true
[[blocks.segments]]
type = 'status'
style = 'diamond'
foreground = '#ffffff'
background = '#2e9599'
background_templates = ['{{ if gt .Code 0 }}#f1184c{{ end }}']
trailing_diamond = ''
template = ' '
[blocks.segments.properties]
always_enabled = true
[[blocks]]
type = 'prompt'
alignment = 'right'
[[blocks.segments]]
type = "executiontime"
style = "diamond"
leading_diamond = ''
trailing_diamond = ''
foreground = "red"
background = "black"
template = "󱦟 {{ .FormattedMs }} "
[blocks.segments.properties]
threshold = 2000
style = "austin"
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
type = 'root'
style = 'plain'
foreground = 'yellow'
template = ' '
[[blocks.segments]]
type = 'text'
style = 'plain'
foreground = 'default'
template = ' '

View file

@ -31,8 +31,7 @@ $scala\
""" """
right_format = """ right_format = """
[\uE0B2](fg:bar_three)\ $cmd_duration\
$time\
""" """
palette = 'theme' palette = 'theme'
@ -93,7 +92,7 @@ Windows = '󰍲'
[directory] [directory]
truncation_length = 0 truncation_length = 0
truncation_symbol = '.../' truncation_symbol = '/'
truncate_to_repo = false truncate_to_repo = false
fish_style_pwd_dir_length = 1 fish_style_pwd_dir_length = 1
style = 'bold fg:text_two bg:bar_two' style = 'bold fg:text_two bg:bar_two'
@ -209,8 +208,5 @@ symbol = ' '
style = 'fg:text_three bg:bar_four' style = 'fg:text_three bg:bar_four'
format = '[ $symbol ($version) ]($style)' format = '[ $symbol ($version) ]($style)'
[time] [cmd_duration]
disabled = false style = 'bold red'
time_format = '%R' # Hour:Minute Format
style = 'fg:text_three bg:bar_three'
format = '[  $time ]($style)'

View file

@ -207,7 +207,10 @@ if command -v zoxide &>/dev/null; then
fi fi
# Init starship prompt -- https://starship.rs # Init starship prompt -- https://starship.rs
eval "$(starship init zsh)" #eval "$(starship init zsh)"
# Oh My Posh
eval "$(oh-my-posh init zsh --config $HOME/.config/jmb.omp.toml)"
# Finally we can have zsh auto source this rc file on command # Finally we can have zsh auto source this rc file on command
# attribution: https://www.reddit.com/r/commandline/comments/12g76v/ # attribution: https://www.reddit.com/r/commandline/comments/12g76v/