Message Boards Message Boards


The Most Convenient Keyboard Shortcuts Ever

Posted 2 years ago
15 Replies
17 Total Likes

Here are two simple but extremely convenient keyboard shortcuts that I've used for years.

  • This post is a favor to all my friends who type slowly (like me)
  • These shortcuts simply create a pair of brackets containing a template placeholder as the current new selection
  • Essentially, it's just a stripped-down version of the bulky (Command + Shift + K + Up/Down Arrow + Enter) completion

Favorite Shortcut #1: Autocomplete single brackets by pressing CommandKey + [

enter image description here

Favorite Shortcut #2: Autocomplete part brackets by pressing CommandKey + ]

enter image description here

How to set them up

On MacOS, first make a backup of the following file, in case you break it:

FileNameJoin[{$InstallationDirectory, "SystemFiles/FrontEnd/TextResources/Macintosh/"}];

On my machine this path resolves to: "/Applications/"

Then, preferably in a non-Mathematica editor (e.g. Sublime), open the above file and copy-and-paste these following code into the list inside EventTranslations. For the first shortcut:


And for the second (of course making sure they are separated by a comma):


Finally, restart Mathematica, and presto, they should both be working. And to remove the shortcuts, simply remove those items or replace the .tr file with the backup.

15 Replies

Sadly, these shortcuts don't work on my Mac. Could that depend on the keyboard layout? I have the following custom key event translations in my file:

(* Matching double quotes*)
      "\"\[SelectionPlaceholder]\"", Placeholder]]],
(* Matching curly braces*)
      "{\[SelectionPlaceholder]}", Placeholder]]],
(* Matching square braces*)
      "[\[SelectionPlaceholder]]", Placeholder]]],
(* Matching parentheses*)
      "(\[SelectionPlaceholder])", Placeholder]]],
(* Matching bracketing bars*)
(* Matching double bracketing bars*)

but only the double quotes and the matching parentheses work correctly. These things used to work fine in version 8, but then they degraded over time. I complained with Wolfram, but they didn't seem to care about maintaining this functionality.

Posted 2 years ago

Hi Gianluca,

I use Control rather than Command on my Mac e.g.



Hi Gianluca, that's too bad! I'm using version 12.0, but I'll try your shortcuts out later and let you know if they work for me.

Posted 2 years ago

Cleaner to place the modified in

FileNameJoin[{$UserBaseDirectory, "SystemFiles/FrontEnd/TextResources/Macintosh"}]

rather than changing the installed application contents.

Hi Rohit, you are correct, but the reason I'm using the system application folder is that I have a few different copies of mma, and I've encountered issues when configuring them from a common $UserBaseDirectory.

It appears that Cmd-[ will not work on my mac either, but if I use Mike's shortcut and change it to Control, it works. I suspect the OS is using CMD-[ for something else. For example, in System Preferences, CMD-[ is back in the view menu. Maybe that definition is global so Mathematica can't use it.



I configured the very same keyboard shortcuts Cmd-[ etc in the BBEdit text editor, and they work fine in there.

enter image description here - Congratulations! This post is now featured in our Staff Pick column as distinguished by a badge on your profile of a Featured Contributor! Thank you, keep it coming!


Please clarify your post. Are you saying that it now works in Mathematica or are you saying that you can use Cmd-[ as a shortcut in another program (but not in Mathematica)?



These shortcuts would only in Mathematica (if you configure them as above).

I have set the BBEdit text editor so that Cmd-[, Cmd-{, Cmd-" Cmd-( give [] {} "" () pairs, enclosing any selected text, and they work fine.

The KeyEventTranslations that I reported above were meant to reproduce the same behaviours, but among them only Cmd-" and Cmd-( perform as desired on my system. I remember that back during Mathematica version 8 (or 7, I am not sure), when I first heard of these tricks, they were working correctly.

I wonder if it is an idiosincrasy of my system.

FYI, check Shortcuts`:


It does not support [_] but [[_]] + many more.

@kuba Cool, thanks for the link I'll check it out. Do you know if there's any overview/list of the ones Rolf supports? Also, do they work on linux and windows as well as macos?

There is an image from Shortcuts documentation attached to the SE post I linked. And it suggests they work on Linux and macOS.

p.s. you may also be interested in:

All my keyboard shortcuts have stopped working with version 12.1. Oh well.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract