I'm hacking on a test framework for vimscript (an exercise in futility, I know; humor me). Some vim plugins make calls out to the shell (with the system() function or the ! command). I want the test driver to be able to grab those calls and return pre-baked data.
As far as I can tell, vim's system() does a fork and runs the command in a subshell. In theory, it should be possible to do something like
alias ls="echo one\ntwo\nthree"
so that we can have a test along the lines of:
:.!ls
and check that the output is
one
two
three
In practice, vim seems to be forking out a subshell that doesn't respect any temporary aliases. In other words, it makes a new clean shell environment using the user's shell (zsh, bash, whatever) but not the user's shell settings (global nor local).
Do you know of any way to run vim in an environment such that certain system calls are controlled by the user?