code: function edit(cmdFile, editor) {
    editor = editor || process.env['VISUAL'] || process.env['EDITOR']
  
    var fds = [process.openStdin(), process.stdout, process.stdout]
      , args = [cmdFile]
  
    // handle things like 'mate -w' and 'emacsclient --server-file <filename>'
    if (editor.match(/\s/)) {
      var words = editor.split(/\s+/) // FIXME this should do proper word splitting ...
      args = words.slice(1).concat(args)
      editor = words[0]
    }
  
    // seed the file with repl.context._ if the file doesn't exist yet
    try {
      fs.statSync(cmdFile)
    }
    catch (e) {
      // skip history[0], it's the .edit command
      var lastCmd = theRepl.rli.history[1]
      if (lastCmd && lastCmd[0] !== '.') {
        fs.writeFileSync(cmdFile, lastCmd)
      }
    }
  
    pause()
    spawn(editor, args, {customFds: fds}).on('exit', function(code) {
      // some editors change the terminal resulting in skewed output, clean up
      spawn('reset').on('exit', function(_) {
        if (code === 0) {
          run(cmdFile, function() { unpause() })
        }
        else {
          unpause()
        }
      })
    })
  }
docs: Commands