From da19c0a6c9e86231605e3c3229ce26bd0f8a58c8 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Mon, 24 Jun 2024 15:20:23 +0200 Subject: [PATCH] Switch to oh-my-posh. --- {config => _linux/_unused}/starship.toml | 0 config/omp/omp.toml | 85 ++++++++++++++++++++++++ config/zsh/.zshrc | 5 +- 3 files changed, 88 insertions(+), 2 deletions(-) rename {config => _linux/_unused}/starship.toml (100%) create mode 100644 config/omp/omp.toml diff --git a/config/starship.toml b/_linux/_unused/starship.toml similarity index 100% rename from config/starship.toml rename to _linux/_unused/starship.toml diff --git a/config/omp/omp.toml b/config/omp/omp.toml new file mode 100644 index 0000000..fa90e53 --- /dev/null +++ b/config/omp/omp.toml @@ -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 }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} {{ 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 diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc index 5afa70f..69f3a4a 100644 --- a/config/zsh/.zshrc +++ b/config/zsh/.zshrc @@ -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