CapsLock - rebind

Is it currently possible to rebind the CapsLock key?
For example I am using Casey's custom configuration and I am trying to toggle the edit/entry mode using the CapsLock key.

Thanks in advance!
There is no way to rebind capslock in the 4coder customization.
I assume remapping caps lock is harder to do than any of the other keys as Vim doesn't let you remap it either. When I'm using Vim on Windows I use AutoHotKey to map caps lock to esc with this script.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
classname = ""
keystate = ""

*Capslock::
  WinGetClass, classname, A
  if (classname = "Vim")
  {
    SetCapsLockState, Off
    Send, {ESC}
  }
  else
  {
    GetKeyState, keystate, CapsLock, T
    if (keystate = "D")
      SetCapsLockState, Off
    else
      SetCapsLockState, On
    return
  }
  return


Its a bit of a bulky solution but you should be able to replace
1
if (classname = "Vim")
with
1
 if (classname = "4coder-win32-wndclass")
to get it to work with 4coder. I assume this is a feature Allen is planning to add in the future so something like this wouldn't be needed.
Thanks for the tip. I know a lot of people swap the ctrl and capsLock key on emacs, turns out they are mostly using external programs like you mentioned. AutoHotKey was also mentioned for Windows. I am going to install it and test your script out.
I remapped my caps lock key (along with the rest of my keyboard) with the Microsoft Keyboard Layout Creator, which was ok - you can switch back to normal QWERTY/layout with a button shortcut, or localise changes to individual processes/applications. Getting it set up took some faffing about, but it was quite a while ago now and I don't really remember why.

Lifehacker suggests KeyTweak, for whatever that's worth.

Edited by Andrew Reece on