I found that in coding I rarely use the square braces []
but use the curly braces {}
often. On most keyboards, these are inputted using Shift+[ or Shift+].
Now I tried to use AutoHotkey to remap these keys by using:
[::{{}
Adding {}
is raw mode basically, but it didn't work. Next I tried
{[}::{{}
but that also didn't work.
Any help?
Best Answer
Using curly brackets for raw key interpretation is only for the Send commands. So, to map [ to { and ] to } you can use:
Note: Remapping a key with its Shift equivalent is troublesome, as most if not all keyboards send the same scancode each time, the only difference being the introduction of the Shift key (which has its own scancode).
For example, pressing [ on my keyboard sends the scancode
01A
and yields a[
. Pressing LShift+[ sends the scancodes02A
and01A
, yielding a{
.Update:
I have successfully overcome the scancode issue with some clever logic! Using the following format, you should be able to switch any key with its Shift pair. Key repetition should also work.
Expanding on this idea, @Bob wrote a more robust version of the script: