Skip to content

Instantly share code, notes, and snippets.

@coppolat1
Created November 25, 2019 16:10
Show Gist options
  • Save coppolat1/9b06d5ba0552a0d281e271545bbe0bfd to your computer and use it in GitHub Desktop.
Save coppolat1/9b06d5ba0552a0d281e271545bbe0bfd to your computer and use it in GitHub Desktop.
AutoHotKey scripts to make Caps + IJKL arrow keys, plus some extras.
;; Make capslock a modifier, make right alt-capslock a true capslock
setcapslockstate, OFF ;SetCapsLockState, alwaysoff
/*
| Shortcut | Output |
| -------------------------------- | -------------------------------- |
| CAPSLOCK + { i, j, k, l } | { Up, Left, Down, Right } |
| CAPSLOCK + { u, o } | { Home, End } |
| CAPSLOCK + { h, n } | { PageUp, PageDown } |
| CAPSLOCK + { m } | { Delete } |
*/
$*Capslock:: ; $ means that the hotkey code shouldn't trigger its own hotkey
Gui, 99:+ToolWindow
Gui, 99:Show, x-1 w1 NoActivate, Capslock Is Down
keywait, Capslock
Gui, 99:Destroy
return
; Made a window show up when the capslock is pressed.
; Now, if that hidden window is there, do anything you like
#IfWinExist, Capslock Is Down
i::Up
j::Left
k::Down
l::Right
u::Home
o::End
h::PgUp
n::PgDn
m::Del
#IfWinExist
; Oh, by the way, right-alt and capslock works like real capslock
ralt & Capslock::
GetKeyState, capstate, Capslock, T
if capstate = U
{
SetCapsLockState, on
} else {
SetCapsLockState, off
}
return
;; Quick and dirty AutoHotKey script to use IJKL as arrows plus a couple
;; other remaps. This ignores any another input modifiers (Shift, Alt)
;; therefore it's a bit unideal.
SetCapsLockState, AlwaysOff
/*
| Shortcut | Output |
| -------------------------------- | -------------------------------- |
| CAPSLOCK + { i, j, k, l } | { Up, Left, Down, Right } |
| CAPSLOCK + { u, o } | { Home, End } |
| CAPSLOCK + { h, n } | { PageUp, PageDown } |
| CAPSLOCK + { m } | { Delete } |
*/
CapsLock & i::
Send % GetKeyState("LShift") ? "+{Up}" : "{Up}"
return
CapsLock & k::
Send % GetKeyState("LShift") ? "+{Down}" : "{Down}"
return
CapsLock & j::
Send % GetKeyState("LShift") ? "+{Left}" : "{Left}"
return
CapsLock & l::
Send % GetKeyState("LShift") ? "+{Right}" : "{Right}"
return
CapsLock & u::
Send % GetKeyState("LShift") ? "+{Home}" : "{Home}"
return
CapsLock & o::
Send % GetKeyState("LShift") ? "+{End}" : "{End}"
return
CapsLock & m::
Send % GetKeyState("LShift")? "+{Del}" : "{Del}"
return
CapsLock & h::
Send % GetKeyState("LShift")? "+{PgUp}" : "{PgUp}"
return
CapsLock & n::
Send % GetKeyState("LShift")? "+{PgDn}" : "{PgDn}"
return
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment