Hey, thanks for reading through this article! I have adapted it since writing this article, but here is my current prompt string configuration (including the necessary bits for git status indicators).
parse_git_dirty(){git_status="$(git status 2> /dev/null)"[["$git_status"=~ "Changes to be committed:"]]&&echo-n"%F{green}·%f"[["$git_status"=~ "Changes not staged for commit:"]]&&echo-n"%F{yellow}·%f"[["$git_status"=~ "Untracked files:"]]&&echo-n"%F{red}·%f"}
setopt prompt_subst
NEWLINE=$'\n'
autoload -Uz vcs_info # enable vcs_info
precmd (){ vcs_info }# always load before displaying the prompt
zstyle ':vcs_info:git*' formats ' ↣ (%F{254}%b%F{245})'# format $vcs_info_msg_0_PS1='%F{254}%n%F{245} ↣ %F{153}%(5~|%-1~/⋯/%3~|%4~)%F{245}${vcs_info_msg_0_} $(parse_git_dirty)$NEWLINE%F{254}$%f '
This is what it looks like.
Enjoy!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks David, one question: what actually is the prompt format string you came up with for your own use? Cheers!
Hey, thanks for reading through this article! I have adapted it since writing this article, but here is my current prompt string configuration (including the necessary bits for git status indicators).
This is what it looks like.
Enjoy!