# How to use this segment 1. save the file somewhere 2. source the file in zshrc before sourcing p10k 3. replace `vcs_info` with `gitstatus` in p10k.zsh (usually located at `~/.p10k.zsh`) # How does it work See the excellently documented [async.zsh](https://github.com/zsh-users/zsh-autosuggestions/blob/master/src/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 the callback function is called, which, updates the parameters and calls p10k to update the prompt.