Just:
require('child_process').spawn('vim', ['test.txt'], {stdio: 'inherit'});
If there is nothing left in the Node.js event loop when vim exits, then node also exits automatically. Or, if you need to ensure that node exits when vim does:
var vim = require('child_process').spawn('vim', ['test.txt'], {stdio: 'inherit'}); vim.on('exit', process.exit);
As for closing the node application before vim exits, this is not entirely possible, because vim inherits the standard input / output / error streams from the spawning process (node), which are destroyed when the node exits.
source share