Zshell aliases like !gst inside vim?

雨燕双飞 提交于 2019-12-01 15:39:42

问题


Is there a way to run my zshell aliases inside vim, with the output going to a new split?

I'm using oh-my-zsh's git aliases like gst, and I am unable to do :!gst inside vim.

Thanks


回答1:


Try

:set shell=zsh\ -l

And put the alias setting to ~/.zshenv

Here is the similar question terminal vim not loading .zshrc.




回答2:


@tim-green is right!

As the man page says:

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.

Since you don't want interactive shell in vim (using ! at least), your only solution is to add (or source) your aliases inside ~/.zshenv.

As simple as that!

EDIT: no other modification is required, except to put:

set shell=/bin/zsh

in your vimrc.



来源:https://stackoverflow.com/questions/22055613/zshell-aliases-like-gst-inside-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!