For this kind of customization, you can use AutoHotkey. It is a Windows-based TSR application that runs in the background and is activated based on certain keystroke scripts.
If you know the AutoHotkey interface, skip over this section...
AutoHotkey bases a keystroke sequence <ks-seq> on its own scripting language and replaces the keystroke combination with some other set of actions <actions> and sends it to the active window. In short, the syntax used (and stored in a file AutoHotkey.ahk, say) is set of expressions of the form
<ks-seq>::<actions>
Here is a list of some of the available commands/keystrokes (taken from AutoHotkey "Send" command documentation):
!: Sends an Alt keystroke. For example, Send This is text!a would send the keys This is text and then press Alt+a. Note: !A produces a different effect in some programs than !a. This is because !A presses Alt+SHIFT+A and !a presses Alt+a. If in doubt, use lowercase.
+: Sends a SHIFT keystroke. For example, Send +abC would send the text AbC, and Send !+a would press Alt+SHIFT+a.
^: Sends a Ctrl keystroke. For example, Send ^!a would press Ctrl+Alt+a, and Send ^{Home} would send Ctrl+Home. Note: ^A produces a different effect in some programs than ^a. This is because ^A presses Ctrl+SHIFT+A and ^a presses Ctrl+a. If in doubt, use lowercase.
#: Sends a WIN keystroke, therefore Send #e would hold down the Windows key and then press the letter e.
...and start reading here again.
As such, you could define the hotkeys
- Ctrl+Alt+p (short for
parentheses) using ^!p::Send (); and
- Ctrl+Alt+b (short for
braces) using ^!b::Send {{}{}}. Note the grouping required for successfully sending { and }.
This is what AutoHotkey.ahk would look like:
; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments. They are not executed.
; Ctrl+Alt+b -> {}
^!b::Send {{}{}}
; Ctrl+Alt+p -> ()
^!p::Send ()
You could append {Left} to each command, which would move the cursor back one spot to between () or {}, if need be. Changes to hotkeys can be made on-the-fly, as long as you
"reload the script" before using it.