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
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
Try
:set shell=zsh\ -l
And put the alias setting to ~/.zshenv
Here is the similar question terminal vim not loading .zshrc.
-i
argument. This tells zsh to run as an interactive program which it is not (when run from inside vim). However the aliases might not be there depending on how your rc scripts are sourced... (I do not know zsh well enough to comment on if your aliases will be sourced in a non interactive shell) –
Syncretize -i
argument does not seem to work either. Maybe you are right about my rc scripts not being sourced, but unfortunately I am a beginner and have no idea how to check. –
Embryonic @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.
© 2022 - 2024 — McMap. All rights reserved.
set shell=zsh\ -i
, which I tried, but it resulted insuspended (tty output)
unfortunately. – Embryonic