Reputation: 895
When I run bash commands from inside of vim I notice that the path is all wrong. Is there a way inside of my .vimrc to have it load my .bash_profile or just inherit the PATH and alias settings from the terminal it's launched from?
Upvotes: 5
Views: 2097
Reputation: 172768
If you've properly done export PATH
in your profile, Vim should inherit the shell's PATH
setting. You can check via :echo $PATH
from inside Vim, and also manipulate it via :let $PATH .= ':/additional/path'
.
If you also need aliases, you have to use Kent's solution. A word of caution: With this modification of 'shellcmdflag'
, you may (depending on the complexity of your shell environment) incur a runtime penalty for every shell invocation from Vim.
Upvotes: 2
Reputation: 195269
if you define the shell as interactive, vim will load your .bashrc or .bash_profile. Default it is not loaded.
This can be done by:
:set shellcmdflag=-ic
default is only -c
, :h shellcmdflag
to see detail. of course you could add it in your .vimrc file.
Upvotes: 7