Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've remapped my Caps lock key to Ctrl+Alt+Shift based on this superuser answer

; Caps lock becomes ctrl+alt+shift
  SetKeyDelay -1
  Send {Blind}{Ctrl DownTemp}{Alt DownTemp}{Shift DownTemp}

*CapsLock up::
  SetKeyDelay -1
  Send {Blind}{Ctrl Up}{Alt Up}{Shift Up}

And then in order to get Vim style navigation, I've attempted to remap hjkl to my arrow keys. I tried several approaches which did not work at all. I've settled on the following approach because it works for single key presses. But when I hold down, for instance, Caps lockJ in Eclipse, the CtrlAltJ keyboard shortcut fires instead of simply going down a line. It only goes off for automatic keyboard repeats, never for the original key press.

  Send {Left}
  Send {Blind}{Ctrl DownTemp}{Alt DownTemp}{Shift DownTemp}

  Send {Down}
  Send {Blind}{Ctrl DownTemp}{Alt DownTemp}{Shift DownTemp}

  Send {Up}
  Send {Blind}{Ctrl DownTemp}{Alt DownTemp}{Shift DownTemp}

  Send {Right}
  Send {Blind}{Ctrl DownTemp}{Alt DownTemp}{Shift DownTemp}

Scrolling down 20 lines by hitting J 20 times is too tedious. Does anyone have a solution, or am I using something inappropriately? I have some other commands mapped to Caps lock and CapslockWin (technically mapped to ^!+ and ^!+#), so fixes would preferably not break those. For instance:

; Caps lock + i becomes escape
  Send {Escape}
  Send {Blind}{Ctrl DownTemp}{Alt DownTemp}{Shift DownTemp}

This works fine right now because I haven't had a need to hold down the Esc key. Thanks!

share|improve this question
Is there any particular reason why you must use Ctrl+Alt+Shift? I would think having CapsLock just toggle a variable would make this easier/simpler. – Elliot DeNolf Dec 7 '12 at 20:21
I was using Ctrl+Alt+Shift because it also had the benefit of letting me set hotkeys in other programs without worrying about collision. But that wasn't working anyway with my attempt, so nothing was lost by switching to your solution below. – Daniel Koverman Dec 10 '12 at 20:25
up vote 2 down vote accepted

This is a sort of alternative to what you are currently doing. I have made it so CapsLock simply toggles the variable cmd. Based upon this variable, your movement keys are enabled. Any of these keys can be held in order to repeat multiple times.

I have also provided some methods, which may be overkill for right now but may prove to be useful to you later.

*CapsLock::    cmd := 1
*CapsLock up:: cmd := 0

#if cmd
    n::Key_repeat("^", "left")
    p::Key_repeat("^", "right")

   SendInput {blind}{%key%}

Key_repeat(pfx, key)
    SendInput {blind}%pfx%{%key%}
share|improve this answer
Thanks a lot, this solves my problem. #if and and the autohotkey method syntax are helpful to know about as well. – Daniel Koverman Dec 10 '12 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .