2

In current Mathematica interface, if I select some piece of code and press CMD + Shift + Enter, the code is evaluated in place. Replacing the selected part by the evaluated version.

The question is:

How can I create an equivalent, so that the evaluated code is presented below the current cell, instead of replace the selected part?

I'm studying R, and in RStudio you can just select some piece of code and press CMD + Enter to evaluate the result in the console. After some months using RStudio, I really miss this functionality in Mathematica interface. Maybe it's possible to hack KeyEventTranslations.tr to do that.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Murta
  • 26,275
  • 6
  • 76
  • 166
  • I'm confused, when you say "in a result cell below the current cell", how is that different than when I evaluate it by hitting Shift+Enter? – Jason B. Nov 19 '15 at 14:11
  • @JasonB probably in the fact that only selected part is evaluated and returned – Kuba Nov 19 '15 at 14:12
  • @JasonB The difference is the Shit+Enter evaluate the whole current cell. I want to evaluate just the selected code. – Murta Nov 19 '15 at 14:13
  • Sorry for the confusion - I wasn't even aware that Ctrl+Enter did something – Jason B. Nov 19 '15 at 14:14
  • @JasonB Imagine you have a cell full of variables, and want to know the current value of a specific item. Today you have to copy it into another location, and evaluate it. – Murta Nov 19 '15 at 14:14
  • This is almost what you need. Instead new notebook add SelectionMove after cell and NotebookWrite. Do you think it is a duplicate? 55620 – Kuba Nov 19 '15 at 14:15
  • @Kuba nice link, I'll make some tests. I think that they are similar, not duplicate. – Murta Nov 19 '15 at 14:19
  • @Murta And I gave an answer... I can join you in retirement shelter... – Kuba Nov 19 '15 at 14:25
  • @Kuba :p I voted to close as duplicate. I believe that the reference is interesting. – Murta Nov 19 '15 at 14:28

0 Answers0