Zshell aliases like !gst inside vim?

后端 未结 2 388
耶瑟儿~
耶瑟儿~ 2021-01-11 21:03

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

2条回答
  •  星月不相逢
    2021-01-11 21:58

    @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.

提交回复
热议问题