feat: switch from starship to oh-my-posh

This commit is contained in:
2024-02-06 10:10:59 +02:00
parent 1f7b92285b
commit 13764775ca
6 changed files with 177 additions and 2 deletions

BIN
.github/screenshots/oh-my-posh.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -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"

150
config/oh-my-posh.omp.json Normal file
View File

@@ -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
}

View File

@@ -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"

View File

@@ -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

18
scripts/install-ohmyposh.sh Executable file
View File

@@ -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"