diff --git a/.github/screenshots/oh-my-posh.png b/.github/screenshots/oh-my-posh.png new file mode 100644 index 0000000..6e60a4d Binary files /dev/null and b/.github/screenshots/oh-my-posh.png differ diff --git a/base/zshrc b/base/zshrc index 0f93663..eaba2aa 100755 --- a/base/zshrc +++ b/base/zshrc @@ -95,5 +95,6 @@ TMUX_WINDOW_NAME_PLUGIN="$DOTFILES/config/tmux/plugins/tmux-window-name/scripts/ add-zsh-hook chpwd tmux-window-name } -eval "$(starship init zsh)" +# eval "$(starship init zsh)" +eval "$(oh-my-posh init zsh --config $XDG_CONFIG_HOME/oh-my-posh.omp.json)" source "$DOTFILES/config/alias" diff --git a/config/oh-my-posh.omp.json b/config/oh-my-posh.omp.json new file mode 100644 index 0000000..1888b4a --- /dev/null +++ b/config/oh-my-posh.omp.json @@ -0,0 +1,150 @@ +{ + "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", + "final_space": true, + "shell_integration": true, + "console_title_template": "{{.UserName}}@{{.HostName}} {{.Shell}} in {{.PWD}}", + "blocks": [ + { + "alignment": "left", + "segments": [ + { + "foreground": "cyan", + "style": "powerline", + "template": "{{ .Icon }}", + "type": "os" + }, + { + "type": "session", + "style": "plain", + "template": " {{ if .SSHSession }} {{ .UserName }}@{{ end }}{{ .HostName }}" + }, + { + "foreground": "cyan", + "properties": { + "style": "mixed" + }, + "style": "plain", + "template": " {{ .Path }} ", + "type": "path", + "mapped_locations": { + "~/Code/*": "\uF09B" + } + }, + { + "type": "git", + "style": "plain", + "foreground": "lightGreen", + "template": "git({{ .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 }})", + "properties": { + "fetch_status": true, + "fetch_upstream_icon": true, + "untracked_modes": { + "~/Code/oh-my-posh/": "no" + } + } + }, + { + "type": "terraform", + "style": "plain", + "foreground": "#000000", + "background": "#ebcc34", + "template": "{{.WorkspaceName}}" + } + ], + "type": "prompt" + }, + { + "alignment": "left", + "segments": [ + { + "foreground": "#68a063", + "properties": { + "display_mode": "files", + "fetch_package_manager": true, + "fetch_version": true + }, + "style": "plain", + "template": " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }}", + "type": "node" + }, + { + "foreground": "#4063D8", + "properties": { + "display_mode": "files", + "fetch_version": true + }, + "style": "plain", + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}", + "type": "crystal" + }, + { + "foreground": "#DE3F24", + "properties": { + "display_mode": "files", + "fetch_version": true + }, + "style": "plain", + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}", + "type": "ruby" + }, + { + "foreground": "#FED142", + "properties": { + "display_mode": "context", + "fetch_virtual_env": false + }, + "style": "plain", + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}", + "type": "python" + }, + { + "type": "php", + "style": "plain", + "template": "  {{ .Full }} " + } + ], + "type": "prompt" + }, + { + "alignment": "left", + "newline": true, + "segments": [ + { + "background": "transparent", + "foreground": "lightGreen", + "foreground_templates": ["{{ if gt .Code 0 }}red{{ end }}"], + "properties": { + "always_enabled": true + }, + "style": "plain", + "template": "\u279c", + "type": "status" + } + ], + "type": "prompt" + } + ], + "transient_prompt": { + "background": "transparent", + "foreground": "lightGreen", + "foreground_templates": ["{{ if gt .Code 0 }}red{{ end }}"], + "template": "\u279c " + }, + "tooltips": [ + { + "type": "git", + "tips": ["git", "g"], + "style": "diamond", + "foreground": "#193549", + "background": "#fffb38", + "leading_diamond": "", + "trailing_diamond": "", + "template": "{{ .HEAD }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}", + "properties": { + "fetch_status": true, + "fetch_upstream_icon": true + } + } + ], + "version": 2 +} diff --git a/local/bin/dfm b/local/bin/dfm index b96ff45..1298196 100755 --- a/local/bin/dfm +++ b/local/bin/dfm @@ -61,6 +61,7 @@ function section_install $0 install fonts $0 install antigen $0 brew install + $0 install ohmyposh $0 install ohmybash $0 install pip $0 install cargo @@ -185,6 +186,11 @@ function section_install bash "$DOTFILES/scripts/install-ohmybash.sh" \ && msg_yay "oh-my-bash installed!" ;; + ohmyposh) + msg "oh-my-posh install started..." + bash "$DOTFILES/scripts/install-ohmyposh.sh" \ + && msg_yay "oh-my-posh installed!" + ;; pip) msg "pip install started..." bash "$DOTFILES/scripts/install-pip-packages.sh" diff --git a/scripts/install-cargo-packages.sh b/scripts/install-cargo-packages.sh index 125f6e9..2cfb7c3 100755 --- a/scripts/install-cargo-packages.sh +++ b/scripts/install-cargo-packages.sh @@ -26,7 +26,7 @@ rustup default system packages=( "cargo-cache" # starship.rs - "starship" + # "starship" # An incremental parsing system for programming tools "tree-sitter-cli" # a subprocess caching utility diff --git a/scripts/install-ohmyposh.sh b/scripts/install-ohmyposh.sh new file mode 100755 index 0000000..c7497ae --- /dev/null +++ b/scripts/install-ohmyposh.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env zsh +# +# Install oh-my-posh +# +# shellcheck source=shared.sh +source "$HOME/.dotfiles/scripts/shared.sh" + +curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin + +OHMYPOSH_CFG="$HOME/.dotfiles/config/oh-my-posh.omp.json" + +eval "$(oh-my-posh init zsh --config $OHMYPOSH_CFG)" + +#cd ~/.dotfiles || exit +#oh-my-posh config export image \ +# --config "$OHMYPOSH_CFG" \ +# --output "~/.dotfiles/.github/screenshots/oh-my-posh.png" \ +# --author "Ismo Vuorinen"