我的终端vim配置没有加载〜/ .zshrc。 Zsh是环境登录shell。这种情况的正确配置是什么?
以下是我已采取并已删除的一些措施:
set shell=zsh
(使用zsh作为shell但不提供rc)
set shellcmdflag=-ci
(所有输出暂停)
cat ~/.zshenv
(打开vim时出现很多错误)
$ source ~/.zshrc
答案 0 :(得分:8)
从手册:
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
应该有用。
答案 1 :(得分:7)
接受的答案并不像预期的那样奏效。实际的解决方案应该是将别名和其他~/.zshrc
内容放入~/.zshenv
。 ~/.vimrc
中唯一需要的是set shell=zsh
,没有任何标记。
答案 2 :(得分:0)
我找到了一个方便的解决方案。因为我真正需要的只是我的所有别名,所以我在~/.zshrc
文件中添加了一个函数:
function zshalias()
{
grep "^alias" ~/.zshrc > ~/.zshenv
}
然后执行source ~/.zshrc && zshalias
。
在你的vimrc中你只需要:
shell=zsh
然后一切都很完美,没有暂停的tty输出!