[ESS] Keybind for "evaluate a multiline command"?

Alexander Engelhardt alexander.w.engelhardt at gmail.com
Thu Mar 12 09:11:08 CET 2015


Hello list,

with the help of library(magrittr), my code becomes more and more 
structured in multiline commands, e.g.:


library(babynames)
library(dplyr)
library(magrittr)
library(ggplot2)

babynames %>%
     filter(name %>% substr(1, 3) %>% equals("Ste")) %>%
     group_by(year, sex) %>%
     summarize(total = sum(n)) %>%
     qplot(year, total, color = sex, data = ., geom = "line") %>%
     add(ggtitle('Names starting with "Ste"')) %>%
     print
head(iris)


I am using shift-enter per line, thereby torturing my enter key when 
running these long commands. Is there a way for ESS to recognize these 7 
lines are one command and run them with only one shift-enter?

I know of ess-eval-region-or-function-or-paragraph-and-step , which 
would run that whole thing in one go, but then it would also execute 
subsequent commands (the "head(iris)" in above snippet) that are not 
separated by a newline.

So ideally, I am looking for a command to bind to shift-enter that would 
run the above thing in six hits: one per library, one for the multiline 
command, and one for the head(iris).

If that doesn't exist, I'll use 
ess-eval-region-or-function-or-paragraph-and-step, which would force me 
to use more newlines in my code, but has the advantage of running all 
the library commands with one hit.

Best wishes,
Alex



More information about the ESS-help mailing list