25
$\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$
25
+500
$\begingroup$

Update 28-Nov-2017

It appears that recent paclet update interferes with Shortcuts` package and breaks predictive interface features (autocompletion etc).

Before the issue is tracked down and fixed it may be required to uninstall it.

Needs @ "Shortcuts`"
UninstallShortcuts[]

and restart Mathematica. If that does not help one may need to delete $UserBaseDirectory.


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$
  • $\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 '17 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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