refactor(prompt): Add hook in the conventional way
Change how I add the `vcs_info` function call to the `precmd` hook. Using add-zsh-hook allows me to have multiple hook functions on `precmd` and makes it clear what is done for each hook when listing them
This commit is contained in:
parent
c2f60ba7fd
commit
43e3ce2765
8
prompt
8
prompt
|
|
@ -22,12 +22,12 @@ zstyle ':vcs_info:git*' check-for-changes true
|
||||||
zstyle ':vcs_info:git*' formats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)"
|
zstyle ':vcs_info:git*' formats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)"
|
||||||
zstyle ':vcs_info:git*' actionformats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)(%a)"
|
zstyle ':vcs_info:git*' actionformats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)(%a)"
|
||||||
|
|
||||||
## set precmd to get vcs_info
|
## do precmd stuff
|
||||||
## precmd runs before every prompt
|
_vcsinfo() {
|
||||||
precmd() {
|
|
||||||
vcs_info
|
vcs_info
|
||||||
setTermTitle "($(whoami)@$(hostname) $(pwd))"
|
|
||||||
}
|
}
|
||||||
|
add-zsh-hook precmd _vcsinfo
|
||||||
|
|
||||||
|
|
||||||
PROMPT="╭╼(%{%F{81}%}%n%{%F{245}%}@%{%F{206}%}%m %{%F{245}%}%2~%{%F{259}%})─(%(?.😎.😞 %?))"$'\n'"╰┤"
|
PROMPT="╭╼(%{%F{81}%}%n%{%F{245}%}@%{%F{206}%}%m %{%F{245}%}%2~%{%F{259}%})─(%(?.😎.😞 %?))"$'\n'"╰┤"
|
||||||
export RPROMPT='${vcs_info_msg_0_}'
|
export RPROMPT='${vcs_info_msg_0_}'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user