chore(zsh): tweak zshrc and move omp conf to omp/

This commit is contained in:
2024-06-15 15:39:41 +03:00
parent b0d74bad1a
commit 9542624323
4 changed files with 199 additions and 18 deletions

View File

@@ -22,6 +22,11 @@ x-have antidot && {
eval "$(antidot init)"
}
x-have oh-my-posh && {
# eval "$(oh-my-posh init zsh --config $XDG_CONFIG_HOME/omp/own.json)"
eval "$(oh-my-posh init zsh --config $XDG_CONFIG_HOME/omp/own.toml)"
}
export COMPLETION_WAITING_DOTS=true
if type brew &> /dev/null; then
@@ -43,12 +48,6 @@ ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
# antigen is present
antigen use oh-my-zsh
export ZSH_TMUX_AUTOSTART=true
export ZSH_TMUX_CONFIG="$DOTFILES/config/tmux/tmux.conf"
export ZSH_TMUX_UNICODE=true
export ZSH_TMUX_AUTOQUIT=false
export ZSH_TMUX_DEFAULT_SESSION_NAME=main
export NVM_DIR="$XDG_CONFIG_HOME/nvm"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
@@ -57,14 +56,10 @@ export ZSHZ_DATA="$XDG_STATE_HOME/z"
antigen bundle z
# these should be always available
antigen bundle tmux
antigen bundle colored-man-pages
antigen bundle command-not-found
antigen bundle ssh-agent
antigen bundle jreese/zsh-titles
antigen bundle zsh-users/zsh-completions
# these should be available if there's need
x-have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
# nvm is a strange beast
@@ -79,10 +74,6 @@ antigen apply
[ -f "${DOTFILES}/config/fzf/fzf.zsh" ] \
&& source "${DOTFILES}/config/fzf/fzf.zsh"
x-have rbenv && {
eval "$(rbenv init - zsh)"
}
x-have pyenv && {
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
@@ -103,10 +94,6 @@ x-have pyenv && {
}
}
# eval "$(starship init zsh)"
x-have oh-my-posh && {
eval "$(oh-my-posh init zsh --config $XDG_CONFIG_HOME/oh-my-posh.omp.json)"
}
source "$DOTFILES/config/alias"
# Herd checks for a few environment variables to inject PHP binaries and configurations.

120
config/omp/own.toml Normal file
View File

@@ -0,0 +1,120 @@
"$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}}"
version = 2
[[blocks]]
alignment = "left"
type = "prompt"
[[blocks.segments]]
foreground = "cyan"
style = "powerline"
template = "{{ .Icon }}"
type = "os"
[[blocks.segments]]
type = "session"
style = "plain"
template = " {{ if .SSHSession }} {{ .UserName }}@{{ end }}{{ .HostName }}"
[[blocks.segments]]
foreground = "cyan"
style = "plain"
template = " {{ .Path }} "
type = "path"
[blocks.segments.properties]
style = "mixed"
[blocks.segments.mapped_locations]
"~/Code/*" = ""
[[blocks.segments]]
type = "git"
style = "plain"
foreground = "lightGreen"
template = "{{ .UpstreamIcon }}{{ if or (.Staging.Changed) (.Working.Changed) }}({{if .Behind }}\u2193 {{ .Behind }} {{ end }}{{if .Staging.Changed }}\uF046 {{ .Staging.String }} {{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }}| {{ end }}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}){{ end }}"
[blocks.segments.properties]
fetch_status = true
fetch_upstream_icon = true
[blocks.segments.properties.untracked_modes]
"~/Code/oh-my-posh/" = "no"
[[blocks.segments]]
type = "terraform"
style = "plain"
foreground = "#000000"
background = "#ebcc34"
template = "{{.WorkspaceName}}"
[[blocks]]
alignment = "left"
type = "prompt"
[[blocks.segments]]
foreground = "#68a063"
style = "plain"
template = " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }}"
type = "node"
[blocks.segments.properties]
display_mode = "files"
fetch_package_manager = true
fetch_version = true
[[blocks.segments]]
foreground = "#4063D8"
style = "plain"
template = " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}"
type = "crystal"
[blocks.segments.properties]
display_mode = "files"
fetch_version = true
[[blocks.segments]]
foreground = "#DE3F24"
style = "plain"
template = " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}"
type = "ruby"
[blocks.segments.properties]
display_mode = "files"
fetch_version = true
[[blocks.segments]]
foreground = "#FED142"
style = "plain"
template = " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}"
type = "python"
[blocks.segments.properties]
display_mode = "context"
fetch_virtual_env = false
[[blocks]]
alignment = "left"
newline = true
type = "prompt"
[[blocks.segments]]
background = "transparent"
foreground = "lightGreen"
foreground_templates = [ "{{ if gt .Code 0 }}red{{ end }}" ]
style = "plain"
template = "➜"
type = "status"
[blocks.segments.properties]
always_enabled = true
[transient_prompt]
background = "transparent"
foreground = "lightGreen"
foreground_templates = [ "{{ if gt .Code 0 }}red{{ end }}" ]
template = "➜ "

74
config/omp/zen.toml Normal file
View File

@@ -0,0 +1,74 @@
#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
version = 2
final_space = true
console_title_template = '{{ .Shell }} in {{ .Folder }}'
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
type = 'path'
style = 'plain'
background = 'transparent'
foreground = 'blue'
template = '{{ .Path }}'
[blocks.segments.properties]
style = 'full'
[[blocks.segments]]
type = 'git'
style = 'plain'
foreground = 'p:grey'
background = 'transparent'
template = ' {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} <cyan>{{ if gt .Behind 0 }}⇣{{ end }}{{ if gt .Ahead 0 }}⇡{{ end }}</>'
[blocks.segments.properties]
branch_icon = ''
commit_icon = '@'
fetch_status = true
[[blocks]]
type = 'rprompt'
overflow = 'hidden'
[[blocks.segments]]
type = 'executiontime'
style = 'plain'
foreground = 'yellow'
background = 'transparent'
template = '{{ .FormattedMs }}'
[blocks.segments.properties]
threshold = 5000
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
type = 'text'
style = 'plain'
foreground_templates = [
"{{if gt .Code 0}}red{{end}}",
"{{if eq .Code 0}}magenta{{end}}",
]
background = 'transparent'
template = ''
[transient_prompt]
foreground_templates = [
"{{if gt .Code 0}}red{{end}}",
"{{if eq .Code 0}}magenta{{end}}",
]
background = 'transparent'
template = ' '
[secondary_prompt]
foreground = 'magenta'
background = 'transparent'
template = ' '