I were following the Modern Vim book by Drew Neil. In tip 20 he writes:
At a glance, you may not be able to tell whether a shell is running within a terminal buffer or outside of Neovim. In this tip, you’ll find out how you can customize the prompt for your shell so that it appears differently inside of a terminal buffer.
. . .
When Neovim starts up, it sets the $NVIM_LISTEN_ADDRESS environment variable. In the start up script for your shell, you can test for the presence of this variable. If $NVIM_LISTEN_ADDRESS is set, then you can assume that the shell is running inside of a terminal buffer. Try adding this snippet to your bashrc file:
if [ -n "$NVIM_LISTEN_ADDRESS" ]; then export PS1="» " else export PS1="\$ " fi
I found that
$NVIM_LISTEN_ADDRESS variable is deprecated. I tried to echo it in neovim session, it is empty.
So there is a question, how to detect if zsh or bash session is run inside nvim? (