Zsh prompt: Add missing %f in VCS prompt, reformat a bit
This commit is contained in:
parent
ec93b23f8f
commit
14ce8345e6
@ -1,5 +1,5 @@
|
||||
# Zsh prompt theme, needs Zsh >= 5.0.0. Asynchronous prompt if zsh-async is
|
||||
# detected
|
||||
# detected. Requires 256 colours.
|
||||
|
||||
function() # Keep local variables in here
|
||||
{
|
||||
@ -26,24 +26,24 @@ autoload -Uz vcs_info
|
||||
zstyle ':vcs_info:*' enable git svn hg # vcs_info_printsys
|
||||
zstyle ':vcs_info:*' formats "%F{${zsh_theme_colours[vcs]}}(%b)%u%c%f "
|
||||
zstyle ':vcs_info:*' actionformats "%F{${zsh_theme_colours[vcs]}}(%b|%F{${zsh_theme_colours[highlight]}}%a%F{${zsh_theme_colours[vcs]}})%u%c%f "
|
||||
zstyle ':vcs_info:*' stagedstr "%F{${zsh_theme_colours[highlight]}}●"
|
||||
zstyle ':vcs_info:*' unstagedstr "%F{${zsh_theme_colours[highlight]}}○"
|
||||
zstyle ':vcs_info:*' stagedstr "%F{${zsh_theme_colours[highlight]}}●%f"
|
||||
zstyle ':vcs_info:*' unstagedstr "%F{${zsh_theme_colours[highlight]}}○%f"
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
|
||||
# Needs mafredri/zsh-async, async_init must be called before using
|
||||
function async_vcs_prompt()
|
||||
{
|
||||
# From https://vincent.bernat.ch/en/blog/2019-zsh-async-vcs-info
|
||||
_my_vcs_async_start() {
|
||||
function _my_vcs_async_start() {
|
||||
async_start_worker vcs_info
|
||||
async_register_callback vcs_info _my_vcs_info_done
|
||||
}
|
||||
_my_vcs_info() {
|
||||
function _my_vcs_info() {
|
||||
cd -q $1
|
||||
vcs_info
|
||||
print ${vcs_info_msg_0_}
|
||||
}
|
||||
_my_vcs_info_done() {
|
||||
function _my_vcs_info_done() {
|
||||
local job=$1
|
||||
local return_code=$2
|
||||
local stdout=$3
|
||||
@ -58,12 +58,12 @@ function async_vcs_prompt()
|
||||
vcs_info_msg_0_=$stdout
|
||||
(( $more )) || zle reset-prompt
|
||||
}
|
||||
_my_vcs_chpwd() {
|
||||
function _my_vcs_chpwd() {
|
||||
# Change colour of old value
|
||||
vcs_info_msg_0_="${vcs_info_msg_0_//\%F\{${zsh_theme_colours[vcs]}/%F{${zsh_theme_colours[inactive]}}"
|
||||
vcs_info_msg_0_="${vcs_info_msg_0_//\%F\{${zsh_theme_colours[highlight]}/%F{${zsh_theme_colours[inactive]}}"
|
||||
}
|
||||
_my_vcs_precmd() {
|
||||
function _my_vcs_precmd() {
|
||||
async_flush_jobs vcs_info
|
||||
async_job vcs_info _my_vcs_info $PWD
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user