30
$\begingroup$

There are various posts here on this site about how to add user defined extra keyboard shortcuts for the front end.

The problem is how to put them into a better maintable and properly documented kernel package. Also the issue of installing and uninstalling the package should be dealt with.

So, the question is whether it is possible to construct such a package and has it been done already?

$\endgroup$
1

1 Answer 1

29
+500
$\begingroup$

Original answer

Yes, with a bit of effort it is possible to construct such a package. My package Shortcuts, inspired by various questions and answers on this site over the years, can be installed in less than a minute from within a fresh notebook in Mathematica 9 or 10, on Windows, MacOSX or Linux by this

Get@"http://goo.gl/aAxplX"

or

Get@"http://www.mertig.com/shortcuts.m"

Note that during installation some dialogs will pop up, which I think should be always confirmed, though if you are very afraid of evaluating Dynamic content in notebooks from others, you might not want to confirm them (though then the shortcuts often trigger an "Enable Dynamics" question in notebooks saved in "insecure" locations).

All code is available on Github here.

I found Windows the most friendly operating system to add user keyboard shortcuts to.

Screen shots of the shortcut listings are:

  • Windows: Windows shortcuts
  • MacOSX: MacOSX shortcuts
  • Linux: enter image description here

The package Shortcuts` gets installed in $UserBaseDirectory/Applications and is loaded automatically when using a keyboard shortcut. The package is documented in the Wolfram Documentation center. If you want to get rid of the shortcuts just do:

Needs["Shortcuts`"];
UninstallShortcuts[];

which deletes the generated KeyEventTranslations.tr file $UserBaseDirectory.

$\endgroup$
5
  • $\begingroup$ I get the autocomplete troubles without Shortcuts, so I don't think the issues with the bad paclet push are related. There is a fix, which should work after deleting the paclets directory. I just installed the Shortcuts package (very nice BTW) and it seems to works just fine in 11.2 without breaking autocomplete. $\endgroup$
    – Jason B.
    Nov 28, 2017 at 15:00
  • $\begingroup$ Very strange, <kbd>F4</kbd> does not work. $\endgroup$ Sep 3, 2020 at 5:32
  • $\begingroup$ @ΑλέξανδροςΖεγγ Which operating system, which Mathematica version? $\endgroup$ Sep 3, 2020 at 8:07
  • $\begingroup$ @RolfMertig Win10, 12.1.1. Actually, the symptom is not "Not work", F4 works sometimes but other times does not. So it seems not that stable as observed, so that I call it "strange". $\endgroup$ Sep 3, 2020 at 8:11
  • $\begingroup$ For me it does work on Win10 12.1.1 $\endgroup$ Sep 3, 2020 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.