Note! this is a function, but is zsh's equivalent for PROMPT_COMMAND in bash.
Commands executed before the prompt is displayed, should be put inside this function.