title: Run current line from vim in console (R, Matlab, Python, etc.) over SSH
body: <p>I often find myself using SSH to remote into a server, and using tmux to split the terminal into two panes: editor (vim) and the console for either R/Matlab/Python, depending on which language I am working with.  This way, I can perform some kind of analysis "interactively," and then use my mouse or tmux to copy the commands to my text editor so that I can make a script out of them.  </p>
  
  <p>This is quite inefficient, as I have to copy all the commands over to my text editor every time I run a command in the console.  If I were working locally, I would open the Matlab GUI/IDE or R Studio, where I can write my commands in a script, and then execute them immediately after writing it with a convenient shortcut (e.g. cmd + enter) that will run the current line.  This way, I can take advantage of the interactive terminal, while also building a script to replicate my work. But often I cannot do X forwarding, so the GUI IDEs are not available.</p>
  
  <p>Is it possible to script vim and/or tmux to somehow run the current line from the editor in the open console session?</p>
  
  <p>Please note that just saving and running the entire file is not a solution, because often the analysis takes significant amount of time, and I do not want to run everything from the beginning.</p>