Calmar on Changing the Keyboard Layout on MS-Windows

You can change the Keyboard setup with writing an additional key to the registry. You can later delete that key without any harm.

regkey

It's the `Scancode Map' key. That key is setuped:


Examples of codes:
Caps Lock 00 3A
Tab 00 0F
L SHIFT 00 2A
R SHIFT 00 36
L CTRL 00 1D
L ALT 00 38
R ALT(GR) E0 38
R CTRL E0 1D
Esc 00 01
Left Win E0 5B
Right Win E0 5C
Apps E0 5D (between right windows and right Ctrl)


Scan-codes reference

Let's say you want on the `Right Alt(GR-Alt) the `Left Alt', put the codes together and you get:

E0 38 00 38

but since Bytes gets stores in the memory from right to left (or so), you need to mirror that to a :

38 00 38 E0

Esc / Caps-lock Changing

For Vim, and when you seldom use MS Windows may just switching Esc with Caps lock might be sufficient:

old Key old code new key new code  RESULT (mirrored)
prefix    00 00 00 00
prefix    00 00 00 00
changes + 1    03 00 00 00
Caps-Lock 00 3a ESC 00 01    01 00 3a 00
ESC 00 01 Caps-Lock 00 3a    3a 00 01 00
End-0    00 00 00 00

together:
00,00,00,00, 00,00,00,00, 03,00,00,00, 01,00,3a,00, 3a,00,01,00, 00,00,00,00

write it into the registry by hand or use a .reg file:

---------------------------------- Start replace_esc_capslock.reg

REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,01,00,3a,00,3a,00,01,00,00,00,00,00

---------------------------------- End file

save, right click and bring it together with the registry and restart :)


My old setup (emacs and MS time):

keyboard keyboard

My complete code for emacs:
Key old key new key code  RESULT (mirrored)
prefix    00 00 00 00
prefix    00 00 00 00
changes + 1    07 00 00 00
Right-Alt(GR-Alt) e0 38 Left Alt 00 38    38 00 38 e0
Right Win e0 5c Right Alt(GR) e0 38    38 e0 5c e0
Apps e0 5d Right Ctrl e0 1d    1d e0 5d e0
Right Ctrl e0 1d Apps e0 5d    5d e0 1d e0
Caps-Lock 00 3a ESC 00 01    01 00 3a 00
ESC 00 01 Caps-Lock 00 3a    3a 00 01 00
End-0    00 00 00 00

together:
00,00,00,00, 00,00,00,00, 07,00,00,00, 38,00,38,e0, 38,e0,5c,e0, 1d,e0,5d,e0, 5d ,e0 ,1d ,e0, 01,00,3a,00, 3a,00,01,00, 00,00,00,00

write it into the registry by hand or use a .reg file:

---------------------------------- Start xy.reg

REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,07,00,00,00,38,00,38,e0,38,e0,5c,e0,1d,e0,5d,e0,5d,e0,1d,e0,01,00,3a,00,3a,00,01,00,00,00,00,00

---------------------------------- End file

save, right click and bring it together with the registry and restart :)



May send comments to: mac@calmar.ws, thanks!