问题
I'm a Mac user and use Iterm2 with zsh
When I open my git directory
next to my branch name, there is a special character with a number
for example (my terminal)
~/projects/myProject | on git mybranch *1
~/projects/myProject | on git mybranch !1
(As far as I guess, !1 is that a file in my directory is modified.)
I want to know what is the meaning of * and ! and also what number means.
and where can I find information on this special character?
my prompt :
${$((_p9k_on_expand()))+}${(e)_p9k_t[7]}${_p9k__1-${${:-${_p9k__d::=0}${_p9k__rprompt::=${_p9k__1r-${${:-${_p9k__bg::=NONE}${_p9k__i::=0}${_p9k__sss::=}}+}${${:-${P9K_CONTENT::=}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=8}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(236|236)}:+10}}${_p9k__n:=11}${_p9k__v::="✔"}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rstatus+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}1}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{236\}%F{070\}${${(M)_p9k__e:#11}:+ }$_p9k__v${${:-${_p9k__w::=%b%K{236\}%F{070\} %b%K{236\}%F{070\}}${_p9k__sss::=%b%K{236\}%F{070\} }${_p9k__i::=1}${_p9k__bg::=236}}+}}${${:-"${${(%):-%j}:#0}"}:+${${:-${P9K_CONTENT::=""}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=12}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(236|236)}:+14}}${_p9k__n:=15}${_p9k__v::=}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rbackground_jobs+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}1}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{236\}%F{037\}${${(M)_p9k__e:#11}:+ }$_p9k__v${${:-${_p9k__w::=%b%K{236\}%F{037\} %b%K{236\}%F{037\}}${_p9k__sss::=%b%K{236\}%F{037\} }${_p9k__i::=3}${_p9k__bg::=236}}+}}}${${:-"${${(%):-%#}:#\#}"}:+${${:-${P9K_CONTENT::=%n@%m}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=16}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(236|236)}:+18}}${_p9k__n:=19}${_p9k__c::=}${_p9k__e::=${${_p9k__1rcontext+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}%246Fwith %b%K{236\}%F{180\}${_p9k__c}%b%K{236\}%F{180\}${${:-${_p9k__w::=%b%K{236\}%F{180\} %b%K{236\}%F{180\}}${_p9k__sss::=%b%K{236\}%F{180\} }${_p9k__i::=29}${_p9k__bg::=236}}+}}}${${:-"${${(%):-%#}:#\%}"}:+${${:-${P9K_CONTENT::=%B%n@%m}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=20}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(236|236)}:+22}}${_p9k__n:=23}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rcontext+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}%246Fwith %b%K{236\}%F{178\}${_p9k__c}%b%K{236\}%F{178\}${${:-${_p9k__w::=%b%K{236\}%F{178\} %b%K{236\}%F{178\}}${_p9k__sss::=%b%K{236\}%F{178\} }${_p9k__i::=29}${_p9k__bg::=236}}+}}}${${:-"${${:-$_p9k__keymap.$_p9k__zle_state}:#(vicmd.*|vivis.*|vivli.*|*.*insert*)}"}:+${${:-${P9K_CONTENT::=OVERTYPE}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=24}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(236|236)}:+26}}${_p9k__n:=27}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rvi_mode+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{236\}%F{172\}${${:-${_p9k__w::=%b%K{236\}%F{172\} %b%K{236\}%F{172\}}${_p9k__sss::=%b%K{236\}%F{172\} }${_p9k__i::=36}${_p9k__bg::=236}}+}}}${${:-"${(M)${:-$_p9k__keymap$_p9k__region_active}:#vicmd0}"}:+${${:-${P9K_CONTENT::=NORMAL}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=28}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(236|236)}:+30}}${_p9k__n:=31}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rvi_mode+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{236\}%F{106\}${${:-${_p9k__w::=%b%K{236\}%F{106\} %b%K{236\}%F{106\}}${_p9k__sss::=%b%K{236\}%F{106\} }${_p9k__i::=36}${_p9k__bg::=236}}+}}}${${:-"${(M)${:-$_p9k__keymap$_p9k__region_active}:#(vicmd1|vivis?|vivli?)}"}:+${${:-${P9K_CONTENT::=VISUAL}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=32}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(236|236)}:+34}}${_p9k__n:=35}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rvi_mode+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{236\}%F{068\}${${:-${_p9k__w::=%b%K{236\}%F{068\} %b%K{236\}%F{068\}}${_p9k__sss::=%b%K{236\}%F{068\} }${_p9k__i::=36}${_p9k__bg::=236}}+}}}${${:-${P9K_CONTENT::=10:17:25}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=36}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(236|236)}:+38}}${_p9k__n:=39}${_p9k__v::=}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rtime+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}1}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}%246Fat %b%K{236\}%F{066\}${_p9k__c}%b%K{236\}%F{066\}${${(M)_p9k__e:#11}:+ }$_p9k__v${${:-${_p9k__w::=%b%K{236\}%F{066\} %b%K{236\}%F{066\}}${_p9k__sss::=%b%K{236\}%F{066\} }${_p9k__i::=40}${_p9k__bg::=236}}+}}$_p9k__sss%b%k%f}}${_p9k__lprompt::=${_p9k__1l-${${:-${_p9k__bg::=NONE}${_p9k__i::=0}${_p9k__sss::=%f}}+}${${:-${P9K_CONTENT::=}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=40}}${_p9k__n:=${${(M)${:-x236}:#x($_p9k__bg|${_p9k__bg:-0})}:+42}}${_p9k__n:=43}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1los_icon+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c}%b%K{236\}%F{255\} ${${:-${_p9k__s::=%F{236\}}${_p9k__ss::=%244F│}${_p9k__sss::=%F{236\}}${_p9k__i::=1}${_p9k__bg::=236}}+}}${${:-${P9K_CONTENT::="%{d%}${:-"%B%F{039}"}${(Q)${:-"\~"}}${:-"%b%K{236}%F{031}"}/${${${_p9k__d:#-*}:+WebstormProjects}:-${:-"%F{103}"}W${:-"%b%K{236}%F{031}"}${$((_p9k__d+=15))+}}/${${${_p9k__d:#-*}:+_personal}:-${:-"%F{103}"}_p${:-"%b%K{236}%F{031}"}${$((_p9k__d+=7))+}}/${:-"%B%F{039}"}react-app-practice${:-"%b%K{236}%F{031}"}%{d%}"}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=68}}${_p9k__n:=${${(M)${:-x236}:#x($_p9k__bg|${_p9k__bg:-0})}:+70}}${_p9k__n:=71}${_p9k__v::=}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1ldir+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}1}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__v}${${(M)_p9k__e:#11}:+ }${_p9k__c}%b%K{236\}%F{031\} ${${:-${_p9k__s::=%F{236\}}${_p9k__ss::=%244F│}${_p9k__sss::=%F{236\}}${_p9k__i::=2}${_p9k__bg::=236}}+}}${(e)_p9k__vcs}%b%k$_p9k__sss%b%k%f${:-" %b%k%f"}}}}+}${(e)_p9k_t[6]}${${_p9k__h::=81.}+}${${_p9k__d::=$((_p9k__m-_p9k__h))}+}${_p9k__lprompt/\%\{d\%\}*\%\{d\%\}/${_p9k__1ldir-${:-"%B%F{039}"}${(Q)${:-"\~"}}${:-"%b%K{236}%F{031}"}/${${${_p9k__d:#-*}:+WebstormProjects}:-${:-"%F{103}"}W${:-"%b%K{236}%F{031}"}${$((_p9k__d+=15))+}}/${${${_p9k__d:#-*}:+_personal}:-${:-"%F{103}"}_p${:-"%b%K{236}%F{031}"}${$((_p9k__d+=7))+}}/${:-"%B%F{039}"}react-app-practice${:-"%b%K{236}%F{031}"}}}${${_p9k__m::=$((_p9k__d+_p9k__h))}+}}${${COLUMNS::=$_p9k__clm}+}
回答1:
Searching for zsh p9k
—which I tried because you mentioned using zsh
and your prompt setting is full of p9k
occurrences—turns up https://github.com/Powerlevel9k/powerlevel9k, which in turn describes itself as obsoleted by https://github.com/romkatv/powerlevel10k. This has a very long description; scrolling approximately halfway down leads to the following (direct link here but this may be fragile over time):
What do different symbols in Git status mean?
When using Lean, Classic or Rainbow style, Git status may look like this:
feature:master ⇣42⇡42 ⇠42⇢42 *42 merge ~42 +42 !42 ?42
followed by a complete table of all possible symbols. The two you asked about, asterisk *
and exclamation point !
, give a count of git stash
entries and unstaged-change-files respectively. The table also shows where these zsh configuration scripts got the information (from running git stash list
and git status --ignore-submodules=dirty
, respectively).
(Note that this has nothing to do with iterm2, and is only related to Git in that various Git commands are the source of the items shown. This question is really about some particular set of scripts for zsh.)
回答2:
It's your shell prompt (PS1 aka PROMPT). The first step would be echo "$PROMPT"
and see what it is set to.
来源:https://stackoverflow.com/questions/65500970/number-with-special-character-next-to-git-branch-name-in-terminal-or-iterm2