- save the file somewhere
- source the file in zshrc before sourcing p10k
- replace
vcs_info
withgitstatus
in p10k.zsh (usually located at~/.p10k.zsh
)
See the excellently documented async.zsh from zsh-autosuggestions for low-level implementation. TLDR: Use process substitution to spawn a zsh instance that executes the main checking logic in the prompt's rendering function and immediately returns. Since the output of the process is connected to a fd of the parent process, we can then use zle's monitor feature to attach a callback function to said fd. After the gawk script finishes and starts to print to the fd