Tuesday, February 12, 2008

Swapping Control Key and Caps Lock for Effective use of Emacs

This post would be helpful to all those sitting out there to use Emacs in an effective way. By the way for non-techy guys/gals, Emacs is an Editor similar to Gvim and Vi.

I find Emacs more efficient and useful than any other editor. You could treat this as one way to push others to Emacs :)

On Windows and Mac keyboards unlike Sun Keyboards the Ctrl key is awkwardly located in the far lower-left position on the keyboard. The Ctrl key is critical to using Emacs at all times, so you'll never become an Emacs virtuoso unless you move it to an easier position. That position should be on Home Row, so Caps Lock is the best choice. That's the location of the Control key on most Unix workstation keyboards, for precisely that reason.

To do this on Windows 2000 or XP requires some registry hacking. From the Start menu, choose Run and enter "regedit". In the left-side tree view, click down to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

Click on the KeyboardLayout entry to give it the focus. Make sure it has the focus and not one of its children. Then from the Edit menu, choose New Binary Value, and name it Scancode Map. It should show as type REG_BINARY.

Then select the new Scancode Map entry you just created, and from the Edit menu (whose contents should have changed), choose Modify Binary Data. In the dialog box called Edit Binary Value, enter the following data:

0000: 00 00 00 00 00 00 00 00
0008: 03 00 00 00 3A 00 1D 00
0010: 1D 00 3A 00 00 00 00 00

Select OK to close the dialog, then exit the Registry Editor. The caps and ctrl keys should be swapped as soon as you log out and back in again. It may require a reboot.

You are all set to use Emacs more effectively. Happy Coding!!

1 comment:

Mahe said...

hey, does this trick work in Vista also? I want to swap "Fn" and "Ctrl" keys. Will see a bit about Emacs :)