# There is a button in the “basic math assistant” which wraps highlighted text in chosen brackets. Is there no keyboard command for this?

This counts as something of a basic question, but one for which I cannot find an answer. I checked the documentation, I checked google, I searched it here, I read a bunch of different things, but nobody seems to have an answer.

Basically, I'm very lazy, and I rarely feel like dealing with wrapping things in brackets if it can be avoided. Things like @ and // are very useful, but there are times when things just must be put in suitable brackets, which can get annoying when working around already written code. If only one could highlight the text and press a keyboard command and suddenly have that text wrapped in brackets...

But wait! In Basic Math Assistant there is a button that does exactly this! It's just quite cumbersome to use given that you need to have that assistant open and click on it, you might as well just do it by hand. Is there any way to get something like this to be done via a keyboard command or something similar?

-
As a start, here's some code to do it. Then you need to assign it to a shortcut. I haven't tried to get this working myself, but it's a good starting point. –  Szabolcs Oct 17 '13 at 0:39

## 1 Answer

Here is the answer given by Rolf Mertig that includes many additional shortcuts.

One of them Ctrl+T, evaluates whatever is stored in joker.m file (invoked by Ctrl+R).

There are already two examples, coincidentally the second one is exactly what you need!

Ok, so briefly:

• Get["http://www.mertig.com/shortcuts.m"]
• reset Mathematica
• use Ctrl+R to open joker.m file
• uncomment the last commented part of script
• save,Ctrl+S, and close file.

Now, whenever you use Ctrl+T it will wrap selected part of code in []. You can modify joker.m to adjust it for your needs ofc.

-