Let's say I run the following command on a node.js file inside Vim:
:terminal node %"
I'd like to continue executing commands on the newly opened window with a single command. But if I try executing :terminal node % | w! /tmp/file | e /tmp/file
it doesn't work. Even though running first :terminal node %
and then :w! /tmp/file | e /tmp/file
manually it works.
Inside vimscript if I try using:
:terminal node %
:w! /tmp/file | e /tmp/file
It also doesn't work. What am I missing? How can execute commands on the new window opened by the terminal
command?
:terminal
at all and certainly not a temporary file. Just do:vnew|:read !node #
. See this gist for a more elaborate solution.