0

On macOS I've set my login shell to bash instead of zsh, which became the default in Catalina (Terminal > Preferences > General > Shells open with: > /bin/bash).

But when I shell escape from vi (from Terminal), the shell command is still run by zsh.
How can I make vi spawn not zsh but rather bash (or at least whatever's in Terminal > Preferences), so a shell escape can run commands defined in ~/.bashrc?

2

That setting only sets the shell used by Terminal. You need to set your log-in shell with chsh -s /bin/bash to make Bash the default one on any other application.

You can also try set shell=/bin/bash in your .vimrc

| improve this answer | |
  • 1
    I'd already done chsh, apparently. Adding that line to .vimrc changed zsh to bash, so I'm accepting this answer. But to make vi read ~/.bashrc, it must be set shell=/bin/bash\ -i. (Also \ -l to read ~/.bash_profile.) – Camille Goudeseune May 11 at 18:54
  • chsh should work. I updated my answer because I forgot the -s flag, maybe that's why it didn't work for you – Tae May 12 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.