Atom Packages Directory

a package directory for a text editor of the 21st Century

R Exec

Install with:
    apm install r-exec


Send R code from Atom to be executed in, Terminal, iTerm, or a web browser running RStudio Server on Mac OS X. The current selection is sent or in the case of no selection the current line is sent.


apm install r-exec


Search for r-exec within package search in the Settings View.



While cmd-enter is bound to sending code in the package, it is also annoyingly bound to entering a new line by default in atom. In order to make it work, you must add the following binding in ~/.atom/keymap.cson:

javascript 'atom-workspace atom-text-editor:not([mini])': 'cmd-enter': 'r-exec:send-command'


All configuration can be done in the settings panel. Alternatively, you can edit your configuration file as noted below.

In your global configuration file (~/.atom/, you may set the following variables:

The default configuration looks like this:

javascript atom.config.set('r-exec.whichApp', '') atom.config.set('r-exec.advancePosition', false) atom.config.set('r-exec.skipComments', true) atom.config.set('r-exec.focusWindow', true) atom.config.set('r-exec.notifications', true) atom.config.set('r-exec.smartInsertOperator', true)

Inserting operators

r-exec currently supports inserting the assignment (<-) and pipe (%>%) operators. It tries to be smart by looking if there is whitespace to the left or the right of the cursor. If there is already whitespace it will not insert additional whitespace. Otherwise, it will insert whitespace. This can be disabled in the settings tab (Smart Insert Operator).

Notes about iTerm

The iTerm2 Applescript API recently changed as of version 3.0.0. Older versions of iTerm2 (< 3.0.0) are supported using mode iTerm. Newer versions of iTerm2 (>= 3.0.0) are supported using mode iTerm2.


Sending code

Inserting operators


It is currently Mac-only because these things are easy to do with AppleScript. Any help on the Windows or Linux side would be great.


Keywords: r, rstats, code, run, runner Suggest keywords
Fork me on GitHub