Answers:
古老的问题,但是zsh中vim的最干净的解决方案是将别名添加到~/.zshenv,zsh会为所有shell,登录名,交互名或其他方式加载该文件。这样可以避免用标志启动vim或zsh以及任何可能的问题。
~/.zshenvvs的解释很不错~/.zshrc:http : //tanguy.ortolo.eu/blog/article25/shrc
基本上,zsh始终是source ~/.zshenv。交互式shell源~/.zshrc和登录shell源~/.zprofile和~/.zlogin。因此,交互式登录外壳程序源~/.zshenv ~/.zprofile ~/.zlogin ~/.zlogin和非交互式非登录外壳程序(如一个vim)仅用于运行命令source ~/.zshenv。
看起来这适用于zsh:
$ZDOTDIR=目录.zshrc位于。例如,export ZDOTDIR=$HOME.vimrc,set shell=zsh\ -i或set shellcmdflag+=i具有相同的效果。这-i是因为,当以交互方式启动时,zshell load $ZDOTDIR/.zshrc。查看man zsh并搜索$ZDOTDIR详细信息。
"+y现在这样复制到系统剪贴板会挂起Vim!superuser.com/questions/712245/…–
我相信当您vim使用:!some_command它时,它将使用环境变量定义的任何外壳$SHELL。
这是可配置的,因此您可以通过覆盖文件中的$SHELL行为来进行更改$HOME/.vimrc以zsh代替使用。
:set shell
shell=/bin/bash
:set shell=zsh\ -i
或者在您.vimrc使用这2行中的1行
set shell=/bin/bash\ -i
set shell=/bin/zsh\ -i
见:help shell从内部vim获取更多信息。
:!{cmd} Execute {cmd} with the shell. See also the 'shell'
and 'shelltype' option.
Any '!' in {cmd} is replaced with the previous
external command (see also 'cpoptions'). But not when
there is a backslash before the '!', then that
backslash is removed. Example: ":!ls" followed by
":!echo ! \! \\!" executes "echo ls ! \!".
After the command has been executed, the timestamp of
the current file is checked timestamp.
$SHELL。所以你的外壳是/bin/bash。如果我的shell是/bin/zsh,那就使用它。
通过设置shell=/usr/bin/zsh\ -l在.vimrc解决我的问题
注意:
我正在使用:linux mint 17.1
.zshrc到.profile中(似乎由vim