title: Is there a hack to be able to run the current line or selection in RStudio without moving the cursor?
body: <p><strong>UPDATE (April 2013):</strong> As per <a href="https://stackoverflow.com/a/15848337/180892">answer below</a>, RStudio no longer jumps cursor on selection.</p>
  
  <hr>
  
  <p>I'm running RStudio 0.97.168.</p>
  
  <p>I like to use the script editor in RStudio like a console. Thus, I run a line of code and then edit it a little bit and re-run it. I often also explore objects by selecting some of the code and running the selection and then progressively altering the selection. At present RStudio always moves the cursor after running a line of code. The cursor can move to a variety of places. Typically the cursor moves to the next line of R code, but depending on the context, it could move to the end of the code block or the next line. It's really frustrating having to  constantly move the cursor back to where I want it. </p>
  
  <p>While I often appreciate the default cursor movement behaviour, I'd  like to have the option to run the selection or the current line without the cursor moving.
  I've raised this as a <a href="http://support.rstudio.org/help/discussions/suggestions/1762-option-to-retain-selection-after-running-selected-r-code" rel="nofollow noreferrer">suggestion on RStudio support</a>.</p>
  
  <p>I'd like to be able to have a shortcut key like "Cmd+Alt+Enter" that runs the current line or selection and does not move the cursor in the script editor.
  I realise that this is not currently supported, but <strong>I was wondering whether there might be some creative hack that could enable the cursor not to move after running a command or even a patch or perhaps some sort of external macro.</strong></p>