Simplify prompt
Massively helped out by this article: https://sureshjoshi.com/development/zsh-prompts-that-dont-suck
This commit is contained in:
parent
977362b096
commit
0e3b5b928f
1 changed files with 27 additions and 4 deletions
31
zshrc.zsh
31
zshrc.zsh
|
@ -119,10 +119,33 @@ export BAT_THEME=$batTheme
|
||||||
# Source the untracked `extra` file
|
# Source the untracked `extra` file
|
||||||
test -e $HOME/.extra && source $HOME/.extra
|
test -e $HOME/.extra && source $HOME/.extra
|
||||||
|
|
||||||
# Oh My Posh
|
# Set the prompt
|
||||||
if (( ${+commands[oh-my-posh]} )); then
|
# We need zsh git integration
|
||||||
eval "$(oh-my-posh init zsh --config $HOME/.config/jmb.omp.toml)"
|
# Autoload zsh's `add-zsh-hook` and `vcs_info` functions
|
||||||
fi
|
# (-U autoload w/o substition, -z use zsh style)
|
||||||
|
autoload -Uz add-zsh-hook vcs_info
|
||||||
|
|
||||||
|
# Set prompt substitution so we can use the vcs_info_message variable
|
||||||
|
setopt prompt_subst
|
||||||
|
|
||||||
|
# Run the `vcs_info` hook to grab git info before displaying the prompt
|
||||||
|
add-zsh-hook precmd vcs_info
|
||||||
|
|
||||||
|
# Style the vcs_info message
|
||||||
|
zstyle ':vcs_info:*' enable git
|
||||||
|
zstyle ':vcs_info:git*' formats '%b%u%c'
|
||||||
|
# Format when the repo is in an action (merge, rebase, etc)
|
||||||
|
zstyle ':vcs_info:git*' actionformats '%F{14}⏱ %*%f'
|
||||||
|
zstyle ':vcs_info:git*' unstagedstr '*'
|
||||||
|
zstyle ':vcs_info:git*' stagedstr '+'
|
||||||
|
# This enables %u and %c (unstaged/staged changes) to work,
|
||||||
|
# but can be slow on large repos
|
||||||
|
zstyle ':vcs_info:*:*' check-for-changes true
|
||||||
|
|
||||||
|
# Set the right prompt to the vcs_info message
|
||||||
|
RPROMPT='%F{8}⎇ ${vcs_info_msg_0_}'
|
||||||
|
|
||||||
|
PROMPT='%(?.%F{blue}⏺.%F{red}⏺)%f %2~ %(!.#.$) '
|
||||||
|
|
||||||
# Finally we can have zsh auto source this rc file on command
|
# Finally we can have zsh auto source this rc file on command
|
||||||
# attribution: https://www.reddit.com/r/commandline/comments/12g76v/
|
# attribution: https://www.reddit.com/r/commandline/comments/12g76v/
|
||||||
|
|
Loading…
Add table
Reference in a new issue