Message Boards Message Boards

Keyboard shortcut for "Evaluate Notebook"

GROUPS:

I recently upgraded to Mathematica 11 for some side projects. I love the program, but I was annoyed to see that there is no keyboard shortcut for the Evaluate Notebook command. F8 appears to be unused in the normal configuration on Linux. So I’m posting a solution for adding F8 as a keyboard shortcut for Evaluate Notebook:

If you are on Linux, all you have to do is edit /usr/local/Wolfram/Mathematica/11.2/SystemFiles/FrontEnd/TextResources/X/MenuSetup.tr

  1. Make a backup of MenuSetup.tr
  2. Open MenuSetup.tr
  3. Search for “Evaluate Notebook”
  4. You’ll find the correct line (there is only one). Add ‘, MenuKey[“F8”, Modifiers->{}]’ after “EvaluateNotebook”
  5. The revised line should read ‘MenuItem[“Evaluate N&otebook”, “EvaluateNotebook”, MenuKey[“F8”, Modifiers->{}]],’
  6. Re-launch Mathematica, and you should see F8 next to the Evaluate Notebook command. Try it out.
  7. Success!

Is there some reason why there is no keyboard shortcut for Evaluate Notebook? I am at a loss because it is simple to add one.

POSTED BY: Andrew Watters
Answer
3 months ago

Probably because it only takes two Ctrl+a and then Shift+Enter.

About your modification, it is good idea to not mess with installation directory but to create correspoding path in $UserBaseDirectory.

p.s. here is a mma.se topic about the same issue: 33197. I find your solution better then using KeyEventTranslations.tr.

POSTED BY: Kuba Podkalicki
Answer
3 months ago

This works on Mac also. I chose Command-Option-E because F8 is assigned to iTunes play/pause by default. Here is the solution:

Edit /Applications/Mathematica.app/Contents/SystemFiles/FrontEnd/TextResources/Macintosh/MenuSetup.tr

  1. Make a backup of MenuSetup.tr
  2. Open MenuSetup.tr
  3. Search for “Evaluate Notebook”
  4. You’ll find the correct line (there is only one). Add ‘, MenuKey[“E”, Modifiers->{"Command","Option"}]’ after “EvaluateNotebook”
  5. The revised line should read ‘MenuItem["Evaluate Notebook", "EvaluateNotebook", MenuKey["E", Modifiers->{"Command","Option"}]],’
  6. Re-launch Mathematica, and you should see Command-Option-E next to the Evaluate Notebook command. Try it out.
  7. Success!
POSTED BY: Andrew Watters
Answer
3 months ago

Note: do not copy and paste the above inserts into your MenuSetup.tr file or Mathematica will give you an error message on launch. This is because the quotes around the "F8" or "E" must be straight quotes, not curly quotes. I don't know why they showed up as curly quotes in this post, but I realized the error when I copied and pasted from my post after installing 11.3. Lol.

POSTED BY: Andrew Watters
Answer
2 months ago

Or perhaps a keyboard shortcut to restart the kernel and then run the entire notebook as a single operation would be a useful time-saving feature?

POSTED BY: Ian Williams
Answer
2 months ago

Group Abstract Group Abstract