我的终端vim配置没有加载〜/ .zshrc。 Zsh是环境登录shell。这种情况的正确配置是什么?
以下是我已采取并已删除的一些措施:
set shell=zsh
(使用zsh作为shell但不提供rc)
set shellcmdflag=-ci
(所有输出暂停)
cat ~/.zshenv
(打开vim时出现很多错误)
$ source ~/.zshrc
我的终端vim配置没有加载〜/ .zshrc。 Zsh是环境登录shell。这种情况的正确配置是什么?
以下是我已采取并已删除的一些措施:
set shell=zsh
(使用zsh作为shell但不提供rc)
set shellcmdflag=-ci
(所有输出暂停)
cat ~/.zshenv
(打开vim时出现很多错误)
$ source ~/.zshrc
从手册:
Commands are first read from /etc/zshenv; this cannot be overridden. [...] Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zprofile and then $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally, if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
据我所知,
set shell=zsh\ -i
应该管用。
从手册:
Commands are first read from /etc/zshenv; this cannot be overridden. [...] Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zprofile and then $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally, if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
据我所知,
set shell=zsh\ -i
应该管用。
接受的答案不能按预期工作。实际的解决方案应该是别名和其他 ~/.zshrc
内容成 ~/.zshenv
。唯一需要的东西 ~/.vimrc
是 set shell=zsh
没有任何旗帜。
我找到了一个方便的解决方案。因为我真正需要的唯一的东西是我的所有别名,我为我添加了一个功能 ~/.zshrc
文件:
function zshalias()
{
grep "^alias" ~/.zshrc > ~/.zshenv
}
然后执行 source ~/.zshrc && zshalias
。
在你的vimrc中你只需要:
shell=zsh
一切都很完美,没有暂停的输出!