4coder » Forums » CapsLock - rebind
joe513
16 posts
#9590 CapsLock - rebind
11 months, 3 weeks ago

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!
Mr4thDimention
Allen Webster
283 posts
2 projects

Heyo

#9591 CapsLock - rebind
11 months, 3 weeks ago

There is no way to rebind capslock in the 4coder customization.
aidanb
Aidan
10 posts
#9593 CapsLock - rebind
11 months, 3 weeks ago

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.
joe513
16 posts
#9594 CapsLock - rebind
11 months, 3 weeks ago

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.
azmr
Andrew Reece
24 posts
1 project

Ergonomics student and maker of things

#9617 CapsLock - rebind
11 months, 3 weeks ago Edited by Andrew Reece on Dec. 2, 2016, 1:54 p.m.

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.