In a sense this is trivially possible in any editor with plugin/scripting capabilities. It's just a question of how much work you're willing to put in.
For example, this blog describes how to do it in Vim. The specific method is not really important, the point is that it's possible because of the features that Vim has:
- it has scripting, so you can read/write to variables and string together operations
- it can evaluate arbitrary system commands
- it has customizable key bindings
So it can basically automate what you would do manually: copy some source code, paste that code into the interpreter, run it, capture the result as text, paste it back in the editor.