sponsor Vim development Vim logo Vim Book Ad

basic Tip #75: Remap CAPSLOCK key in Windows 2000 Professional and NT4.0

 tip karma   Rating 322/106, Viewed by 18112 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   June 7, 2001 5:54      complexity:   basic
author:   Igor Prischepoff      as of Vim:   5.7

If you're Windows 2000 Professional user and got tired to move your hands off basic row when hitting <ESC> key
here the solution (not for Windows 9x.):
remap CapsLock key as <ESC> key. It's located in useful position.
Put this lines into <EscLock.reg> file and start it in explorer.Reboot.Enjoy.

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

To restore you capslock back just delete this entry from Registry and reboot.
And below is remapping <capslock> as <Left Control>:

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

 rate this tip  Life Changing Helpful Unfulfilling 

<< Using Vim as an outline processor | Folding for Quickfix >>

Additional Notes

[email protected], July 15, 2001 10:15
Windows:
There is an excellent free tool available to remap the capslock to control ,
thereby putting a control key in "the right place"(tm).  
I think the source code is included too.
There are versions for both WinNT/2000 and Win98/95/Me.
Look on http://www.sysinternals.com/.
While they are easy to find, here are the direct links:
http://www.sysinternals.com/ntw2k/source/ctrl2cap.shtml
http://www.sysinternals.com/win9x/utilities/ctrl2cap95.shtml

Linux/Unix:
Here's how to map the caps lock key to a control under X windows,
at least under xfree86-3.x and 4.x:
Add a file named ".Xkbmap" in your home directory with this content:
-option ctrl:nocaps

[email protected], July 19, 2001 7:01
It would be useful to remap caps lock to some other out-of-the-way key.  In linux I map it to F4, but how would I do that in w2k?
[email protected], July 20, 2001 13:21
Here's what I use to remap the caps lock key to ctrl and the left-ctrl to caps-lock on a win2k machine:

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

This is a little cleaner than the example at the sysinternals site. It's a combo of the original information in the tip plus info that I found at the following MS site:

http://www.microsoft.com/HWDEV/input/W2kscan-map.htm

note that their scan key maps are a little off.

-- Juan
[email protected], August 21, 2001 11:16
Personally, I just hit ctrl-[ (that's holding the control key and the left angle bracket down at the same time), which creates the escape key almost anywhere.  I'm so used to touch typing it I don't even think about it any more.
[email protected], August 15, 2002 9:31
Having such a large part of my UI for functionality as obscure as capslock is strange indeed.
My ideal setup would be to have <CapsLock> do nothing at all so accidental hits don't mess
up my blind typing, and to have it effective if I'm also holding down <Shift> (for those rare
occasions when I feel like SHOUTING).
[email protected], March 1, 2004 13:29
the enter key only works on my win2k machine if i hit: ctrl (left) and the enter key simulatenously...how would i remap that two-key combo back to just the return key (single key hit)?
leifw (at) bigfoot , com, June 8, 2004 20:19
Here's what I use to map Caps Lock to Escape and leave Escape as Escape.

-------------Begin File-----------------------
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,29,00,3a,00,00,00,00,00
-------------End File-------------------------
leifw (at) bigfoot , com, June 11, 2004 15:40
Please ignore the above comment I posted.  The registry entry at the top of this post worked fine for me and what I posted didn't.
[email protected], June 15, 2004 9:59
I'd like to remap Capslock to Ctrl-S so I have a quick, one-finger way to save my work frequently.  Does any one know the value I'd use instead of those in the example for remapping Capslock to Esc?

Anonymous, July 20, 2004 2:04
Are there any method to remap the capslock key without the NT administrator rights ? Thanks.
Anonymous, January 21, 2005 17:22
This hint is almost perfect. You can fly on vim with that. but it would be perfect if someone post where to get more info on that registry key remapping... theres plenty more i'd like to change :)

but this one is a great start already! Thanks!
Anon, January 26, 2005 9:36
I hit <C-C> (Control C) instead of ESC, which is much easier than <C-]> (or was it <C-[>?) on my dvorak layout. This gets my job done almost everywhere, like getting out of input mode etc.

On some terminals the beeping during <C-C> is disturbing, so I remapped <C-C> to <ESC> in vim.
(It was :nno <C-C> <ESC> or something like that.)
Anonymous, February 9, 2005 13:45
remapkey.exe ----a gui built in to winXP and other m$ OS that creates needed registry entries to remap keys
Anonymous, May 19, 2005 18:45
I use the AutoHotkey script similar to vimtip#285, which does not require administrator rights in M$ windows.
my life is a lot easier when bypassing those sysadmin!  ;)
[email protected], September 16, 2005 10:57
Hello!

I'm helping developing the new NEO keyboardlayout for german and anglicisms... the inventor uses linux and I am one of the few Windows users...

We want to use Capslock as a second AltGR (you know, the key between Space and the right win key)

Which Reg-Key do we have to  do to remap CapsLock to AltGR?

We don't wanna use a program or a driver... this reg-solution would be the finest of all... :)

I hope anyone can help! :)

with greets from Germany...

akoustikubas

http://pebbles.schattenlauf.de/layout/index_us.html
zolfagharsoft, August 12, 2006 6:03
Can anybody change # to 3.
I need it . if you can please help me.
with regard.
Anonymous, September 15, 2006 8:38
Does anyone know of a way to turn Caps Lock on for the Windows Logon Screen
[email protected], December 17, 2006 0:14
Hooah, now all I need to do is figure out how to map both to escape instead of swap them :-)

Even when I have to type in ALLCAPS I hold shift, I never use the capslock key hehe.
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo