From my testing, it's clear that nvim doesn't source your .bash_profile when opening a new terminal buffer. I would like to force this to happen every time a new terminal buffer is created.
To confirm this behavior:
- open your .bash_profile in nvim
- export a new variable like
ISSOURCED
- write out the file
- open a terminal buffer
- run
echo $ISSOURCED
I've also checked that bash is running in interactive mode (it is) by executing if tty -s; then echo interactive; fi
, based on this answer
However it is not a login shell, based on executing shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'
, based on this answer. This means that it would normally source $HOME/.bashrc
. Unfortunately I keep my bashrc in a different location and source it from my .bash_profile, so it isn't being picked up.
See my answer below for my current workaround and information about why it's less than ideal.