From e4d2947f6684a1667fc299eddc741822f623a178 Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Tue, 11 Jun 2024 23:44:44 +0200 Subject: [PATCH] added oh-my-posh. Removed p10k --- .config/oh-my-posh/config.toml | 141 +++++++++++++++++++++++++++++++++ .zshrc | 9 +-- 2 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 .config/oh-my-posh/config.toml diff --git a/.config/oh-my-posh/config.toml b/.config/oh-my-posh/config.toml new file mode 100644 index 0000000..b3d8aba --- /dev/null +++ b/.config/oh-my-posh/config.toml @@ -0,0 +1,141 @@ +#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json + +version = 2 +final_space = true +disable_notice = true + +[palette] +status_success = "#43f716" +status_failure = "#f72916" +white = "#FFFFFF" +path = "green" +git_tooltip = "red" +go_tooltip = "green" +node_tooltip = "green" +docker = "blue" +kube = "yellow" + +[[blocks]] +alignment = "left" +type = "prompt" + + # SSH + [[blocks.segments]] + type = "session" + template = "{{ if .SSHSession}}󰢹 {{ end }}" + + # Path + [[blocks.segments]] + type = "path" + background = "p:path" + foreground = "p:white" + style = "diamond" + leading_diamond = "" + trailing_diamond = "" + template = " {{ .Path }} " + [blocks.segments.properties] + style = "full" + home_icon = "~" + + +[[blocks]] +alignment = "right" +type = "prompt" + + # Docker context + [[blocks.segments]] + type = "docker" + style = "diamond" + foreground = "p:white" + background = "p:docker" + leading_diamond = "" + trailing_diamond = "" + template = " {{ .Context }}" + + # kubectl context + [[blocks.segments]] + type = "kubectl" + style = "diamond" + foreground = "p:white" + background = "p:kube" + leading_diamond = "" + trailing_diamond = "" + template = "󱃾 {{.Context}}{{if .Namespace}} :: {{.Namespace}}{{end}} " + + # Newline prompt + [[blocks.segments]] + type = "status" + style = "plain" + foreground = "p:status_success" + foreground_templates = [ + "{{ if .Error }}p:status_failure{{ end }}", + "{{ if not .Error}}p:status_success{{ end }}" + ] + template = "\n❯" + [blocks.segments.properties] + always_enabled = true + +[transient_prompt] +foreground = "p:status_success" +template = "❯ " + +# Git +[[tooltips]] +type = "git" +tips = [ "git", "g" ] +style = "diamond" +foreground = "p:white" +background = "p:git_tooltip" +leading_diamond = "" +trailing_diamond = "" +template = "{{ url .HEAD .UpstreamURL }}{{ if .UpstreamIcon }} {{.UpstreamIcon}} {{ end }}{{ if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}" + [tooltips.properties] + fetch_status = true + fetch_upstream_icon = true + branch_icon = " " + branch_identical_icon = " " + branch_ahead_icon = "󰳡 " + branch_behind_icon = "󰳛 " + branch_gone_icon = " " + [tooltips.properties.upstream_icons] + "git.kapelle.org" = " " + +# Go +[[tooltips]] +type = "go" +tips = [ "go" ] +style = "diamond" +foreground = "p:white" +background = "p:go_tooltip" +leading_diamond = "" +trailing_diamond = "" +template = " {{ .Major }}.{{ .Minor }}" +[tooltips.properties] +cache_version = true + +# Rust +[[tooltips]] +type = "rust" +tips = [ "rustc", "cargo", "rustup" ] +style = "diamond" +foreground = "p:white" +background = "p:go_tooltip" +leading_diamond = "" +trailing_diamond = "" +template = " {{ .Full }}" +[tooltips.properties] +cache_version = true + +# Node +[[tooltips]] +type = "node" +tips = [ "node", "npm" ] +style = "diamond" +foreground = "p:white" +background = "p:node_tooltip" +leading_diamond = "" +trailing_diamond = "" +template = "󰎙 {{ .Full }}" +[tooltips.properties] +cache_version = true + diff --git a/.zshrc b/.zshrc index 50fe957..b4ead2d 100644 --- a/.zshrc +++ b/.zshrc @@ -17,17 +17,14 @@ export PATH=$HOME/.local/bin:$XDG_DATA_HOME/npm_global/bin:$XDG_DATA_HOME/cargo/ # NIXOS specific stuff source /etc/zshrc -# P10K stuff -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi -[[ ! -f ~/.cache/p10k.zsh ]] || source ~/.cache/p10k.zsh - # wal subshell for terminal colors if test -f $XDG_CACHE_HOME/wal/sequences; then (cat $XDG_CACHE_HOME/wal/sequences &) fi +# Start oh-my-posh +eval "$(oh-my-posh init zsh --config $XDG_CONFIG_HOME/oh-my-posh/config.toml)" + # Variables export MANPAGER="bat -l man -p"