Environment: debian9+vim7.4.
cat .bashrc
add(){
echo $(expr $1 + $2)
}
Now edit a file in vim
add 1 5
I suppose this should solve it for you. It's more of a workaround than an explanation of you problem but it gets the job done
:execute '! source ~/.bashrc; source '.expand('%:p')
I'm just manually sourcing bashrc before calling the command. One possible explanation to your problem is if you are on a mac. As far as I know OSX don't source bashrc, they do source bash_profile though.