How to: How do I initialize direnv when using instant prompt?
If you've enabled [instant prompt](#instant-prompt), you should have these lines at the top of
`~/.zshrc`:

```zsh
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
```

To initialize direnv you need to add one line above that block and one line below it.

```zsh
(( ${+commands[direnv]} )) && emulate zsh -c "$(direnv export zsh)"

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

(( ${+commands[direnv]} )) && emulate zsh -c "$(direnv hook zsh)"
```

*Related*: [How do I export GPG_TTY when using instant prompt?](
  #how-do-i-export-gpg_tty-when-using-instant-prompt)