I'm trying to write a function to open a split terminal in Vim and then run the current file in that terminal. A non-working example trying to explain what I'm trying to do is
This just opens up the terminal. I tried with another command,
dir, and it seems it's fails because
dir is not a Vim command, so it's still trying to run things in Vim rather than the terminal. I also tried putting the command on the same line e.g.
:bel term % but I get an error:
Error detected while processing function Foo:
And the terminal doesn't even open.
I also tried
though that had the expected result of essentially running
!dir and then returning me to a split window with nothing in the terminal there.
I've also tried to use the
feedkeys() function but I can't find a way to automatically pass the file name in.
How could I achieve this? If it's relevant I'm running Vim on Windows through cmd.