Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've checked MathematicaPreferences, and poked around the options on the toolbar. However, I don't see a way to define new keyboard shortcuts in Mathematica.

I've used VIM for 10+ years, and I've rebound Ctrl+F to be Esc for the last decade or so. I would like to also use this shortcut in Mathematica, to have Ctrl+F be Esc, so hitting something like:

Ctrl+F S Ctrl+F

should give me capital Sigma.

Question: how do I define new keybindings in Mathematica?

(I have a CS background, so I'd prefer things that involve editing config files / writing scripts -- that would give me more power -- over clicking things in a GUI).

share|improve this question
why not rebind it at the OS level if you're married to it? Also see this related question: Looks like vim users are pretty anal about their bindings... ;) – R. M. Jun 29 '12 at 0:46
There are want to rebind caps-lock to esc; but I only want to rebind ctrl-f to esc (my caps-lock is bound to ctrl). Truth be told, all I need is a turing-complete keyboard mapping language, and I'd be happy. – user1602 Jun 29 '12 at 0:53
Changed title to reflect a more general problem, and added Q to customization wiki as perfect example. – István Zachar Jun 29 '12 at 8:32
You can use Autohotkey for a systemwise remap. It is easy as hell, and the script can be turned on/off on the fly anytime with a click (which is not true for changes made to – István Zachar Jun 29 '12 at 8:39
up vote 11 down vote accepted

Since you want this functionality to be able to insert aliases using the EscshortcutEsc syntax, you can edit the file to achieve this. Copy the following file:


or its equivalent on your system to $UserBaseDirectory/ (with the same directory tree) and add the following modifications after EventTranslations[{ in the file:

Item[KeyEvent["f", Modifiers -> {Control}],
                "\[AliasDelimiter]", After]
share|improve this answer
Also, since you're editing your .tr file, you might as well include these shortcuts for 〚〛 (or Part) too, while you're at it, as these are very useful and commonly used – R. M. Jun 29 '12 at 1:06
I wonder, how easy is to maintain such changed system files as when someone changes to a new version of Mathematica and/or to a new computer? Can these customized files handled in a bunch? Would a software update revert these to default? – István Zachar Jun 29 '12 at 8:35
@IstvánZachar You can put a version of with your changes in $UserBaseDirectory/SystemFiles/FrontEnd/TextResources/Macintosh/ because this file is read before the` under $InstallationDirectory an so survives new Versions. – Peter Breitfeld Jun 29 '12 at 9:33
@IstvánZachar As Peter said, the files in $UserBaseDirectory supersedes the installation files. In my answer too, I suggest modifying this file and not the installation file – R. M. Jun 29 '12 at 15:11
@PeterBreitfeld Like you suggested, I cpoied KeyEventTranslations.trand MenuSetup.trin $UserBaseDirectory\SystemFiles\FrontEnd\TextResources\Windows. These were modified Mma10 files. But since then I'm not able to start Mm9 correctly. Where is my fault? – Phab Nov 25 '14 at 12:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.