How do I define custom shortcuts in WinEdt 7?

In WinEdt 5.5 I defined some keyboard shortcuts like Ctrl+Shift+Q to insert quotation marks (\enquote{****}) or Ctrl+Shift+I to italicize the text (\emph{****}) (where **** stands for the currently marked text). This was done through Options -> Menu Setup.

In WinEdt 7 (and possibly also in WinEdt 6) this menu option no longer exists, but I am sure that it is still possible to define those shortcuts. But where and how?

-
You have to edit the MainMenu.ini file appropriately – Harish Kumar Jul 25 '12 at 11:07

I figured it out! Harish is right, it's the MainMenu.ini file, but you don't need to bother finding it in your filesystem. WinEdt does that for you. And, as far as I understand, you actually have to do the editing in WinEdt itself since WinEdt produces some extra "code" for the shortcut that you create and that code would not be there if you edited manually in another editor.

So here is what you do: Go to the Options -> Options Interface. In the interface that opens up in the lefthand column, double click Menus and Toolbar... and then double click Main Menu. That's when the MainMenu.ini opens for you!

Now, here's the tricky part: Let's assume the command that you want to create shortcut for is already defined in one of WinEdt's menues (I'll use \emph{}). Find that Menuitem in the MainMenu.ini code (in my case it's in lines 1261-1266). Here you can see the path to the macro that is being called (%b\Menus\Insert\Emph.edt) and you may get the idea to use it as a template for other macros, but that's just an aside.

In order to create a shortcut for this existing menu-item, create a new empty line insert SHORTCUT="" after the line that says REQ_DOCUMENT=1, i.e. before the line that defines the next ITEM=... Now move the cursor so that it sits just between the two "" and click Insert Shortcut in the Options Interface. It's the icon with the hand on the keyboard. It looks like this (note that you have to have Main Menu in order to see that button):

The rest is pretty self explanatory. Type in your shortcut and click OK.

You will see that WinEdt has inserted not only the human-readable version of your shortcut but also some figures which I assume are the machine-readable version of that shortcut. As I mentioned above, I don't think you can create that code yourself and so you better follow the steps described here (correct me if anyone knows more about this).

But wait: You're not done yet! In order for the shortcut to work (and to appear in the Menu), you need to click on Load Current Script which is the button with the script role on the very left of the image above.

Last step: Unless you are in a Sisyphus mood: hit save before you close the MainMenu.ini.

-
Very good effort. – Harish Kumar Jul 25 '12 at 23:50
I can't find the Insert Shorcut icon. In my WinEdt 6 there are only the first three. Do you other place where I could find it? UPDATE: Actually I just figure out. I double clicked in SHORTCUT word and the shorcut dialog just came out. Thanks! – Daniel Bonetti Sep 3 '14 at 17:41