我如何获得 vim 的 :sh 命令来获取我的 bashrc? [英] How do I get vim's :sh command to source my bashrc?
问题描述
每当我使用 :sh 在 vim 中启动 shell 时,它都不会提供我的 ~/.bashrc 文件.如何让它自动执行此操作?
Whenever I start a shell in vim using :sh, it doesn't source my ~/.bashrc file. How can I get it to do this automatically?
推荐答案
参见 :help 'shell'
.您可以将此字符串设置为包含 -l
或 --login
,这将获取您的 .bashrc
文件.所以,你的 .vimrc
中可能有这样一行:
See :help 'shell'
. You can set this string to include -l
or --login
, which will source your .bashrc
file. So, you might have a line like this in your .vimrc
:
set shell=bash\ --login
请注意,这将改变调用 shell 的所有内容,包括 :!
.这应该不是什么大问题,但您应该意识到这一点.
Note that this will alter everything that invokes the shell, including :!
. This shouldn't be much of a problem, but you should be aware of it.
这个命令的值也可以通过设置$SHELL
环境变量来改变.
The value of this command can also be changed by setting the $SHELL
environment variable.
这篇关于我如何获得 vim 的 :sh 命令来获取我的 bashrc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!