zsh: Replace p10k with oh-my-posh
This commit is contained in:
parent
7ecb63d1a0
commit
6fe0266439
3 changed files with 83 additions and 1748 deletions
81
.config/oh-my-posh/config.yaml
Normal file
81
.config/oh-my-posh/config.yaml
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
|
||||||
|
version: 2
|
||||||
|
final_space: true
|
||||||
|
pwd: osc7
|
||||||
|
disable_cursor_positioning: true
|
||||||
|
blocks:
|
||||||
|
- type: prompt
|
||||||
|
alignment: left
|
||||||
|
newline: true
|
||||||
|
segments:
|
||||||
|
- type: path
|
||||||
|
style: plain
|
||||||
|
foreground: "#999"
|
||||||
|
template: "<b><i>{{ .Path }}</i></b> "
|
||||||
|
properties:
|
||||||
|
style: full
|
||||||
|
|
||||||
|
- type: prompt
|
||||||
|
alignment: right
|
||||||
|
filler: "<#333>⎯</>"
|
||||||
|
segments:
|
||||||
|
- type: git
|
||||||
|
style: plain
|
||||||
|
foreground: "#777"
|
||||||
|
foreground_templates:
|
||||||
|
- "{{ if or (.Working.Changed) (.Staging.Changed) }}#3b8{{ end }}"
|
||||||
|
- "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#3b8{{ end }}"
|
||||||
|
- "{{ if gt .Ahead 0 }}#B388FF{{ end }}"
|
||||||
|
- "{{ if gt .Behind 0 }}#B388FB{{ end }}"
|
||||||
|
template: " <i>{{ .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 }}</i>"
|
||||||
|
properties:
|
||||||
|
fetch_status: true
|
||||||
|
|
||||||
|
- type: rprompt
|
||||||
|
segments:
|
||||||
|
- type: executiontime
|
||||||
|
style: plain
|
||||||
|
foreground: "#c93"
|
||||||
|
template: "<i> {{ .FormattedMs }}</i>"
|
||||||
|
properties:
|
||||||
|
threshold: 500
|
||||||
|
|
||||||
|
- type: session
|
||||||
|
style: plain
|
||||||
|
foreground: "#666"
|
||||||
|
template: " <i>{{ .UserName }}@{{ .HostName }}</i>"
|
||||||
|
|
||||||
|
- type: time
|
||||||
|
style: plain
|
||||||
|
foreground: "#666"
|
||||||
|
template: " <i>{{ .CurrentDate | date .Format }}</i>"
|
||||||
|
properties:
|
||||||
|
time_format: "15:04"
|
||||||
|
|
||||||
|
- type: prompt
|
||||||
|
alignment: left
|
||||||
|
newline: true
|
||||||
|
segments:
|
||||||
|
- type: path
|
||||||
|
style: plain
|
||||||
|
foreground: "#678"
|
||||||
|
template: "<i>{{ .Path }}</i>"
|
||||||
|
properties:
|
||||||
|
style: folder
|
||||||
|
|
||||||
|
- type: text
|
||||||
|
style: plain
|
||||||
|
foreground: "#6c9"
|
||||||
|
template: " %"
|
||||||
|
properties:
|
||||||
|
style: folder
|
||||||
|
|
||||||
|
transient_prompt:
|
||||||
|
background: transparent
|
||||||
|
foreground: "#6c9"
|
||||||
|
template: "\n%% "
|
||||||
|
filler: "-"
|
16
.zshrc
16
.zshrc
|
@ -1,10 +1,3 @@
|
||||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
|
||||||
# Initialization code that may require console input (password prompts, [y/n]
|
|
||||||
# confirmations, etc.) must go above this block; everything else may go below.
|
|
||||||
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
|
|
||||||
|
|
||||||
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
|
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
|
||||||
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
|
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
|
||||||
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
|
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
|
||||||
|
@ -29,7 +22,6 @@ zi ice wait lucid
|
||||||
zi load olets/zsh-abbr
|
zi load olets/zsh-abbr
|
||||||
zi ice wait lucid
|
zi ice wait lucid
|
||||||
zi snippet https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/shrink-path/shrink-path.plugin.zsh
|
zi snippet https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/shrink-path/shrink-path.plugin.zsh
|
||||||
zinit ice depth=1; zinit light romkatv/powerlevel10k
|
|
||||||
|
|
||||||
zstyle ':completion:*' use-cache on
|
zstyle ':completion:*' use-cache on
|
||||||
zstyle ':completion:*' cache-path ~/.zsh/cache
|
zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||||
|
@ -151,10 +143,6 @@ rg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
## Prompt
|
|
||||||
# setopt TRANSIENT_RPROMPT
|
|
||||||
# eval "$(starship init zsh)"
|
|
||||||
|
|
||||||
## vim
|
## vim
|
||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
|
|
||||||
|
@ -282,5 +270,5 @@ compdef _grc grc
|
||||||
# Atuin history
|
# Atuin history
|
||||||
eval "$(atuin init zsh --disable-up-arrow)"
|
eval "$(atuin init zsh --disable-up-arrow)"
|
||||||
|
|
||||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
# Prompt
|
||||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
eval "$(oh-my-posh init zsh --config $HOME/.config/oh-my-posh/config.yaml)"
|
||||||
|
|
Loading…
Add table
Reference in a new issue