Skip to content

Instantly share code, notes, and snippets.

@scottming
Last active January 11, 2023 17:19
Show Gist options
  • Save scottming/5405b12eb2c69a4e0e54 to your computer and use it in GitHub Desktop.
Save scottming/5405b12eb2c69a4e0e54 to your computer and use it in GitHub Desktop.
; Autohotkey Capslock Remapping Script
; Autohotkey Capslock Remapping Script
; - Deactivates capslock for normal (accidental) use.
; - Hold Capslock and drag anywhere in a window to move it (not just the title bar).
; - Access the following functions when pressing Capslock:
;Cursor keys - h, j, k, l
;Home,End - N, ;
;Page up,down - - =
;Esc - CapsLock only
;CapsLock - Space
#Persistent
SetCapsLockState, AlwaysOff
; Capslock + hjkl (left, down, up, right)
Capslock & h::Send {Blind}{Left DownTemp}
Capslock & h up::Send {Blind}{Left Up}
Capslock & j::Send {Blind}{Down DownTemp}
Capslock & j up::Send {Blind}{Down Up}
Capslock & k::Send {Blind}{Up DownTemp}
Capslock & k up::Send {Blind}{Up Up}
Capslock & l::Send {Blind}{Right DownTemp}
Capslock & l up::Send {Blind}{Right Up}
; Capslock + n (home, end)
Capslock & n::SendInput {Blind}{Home Down}
Capslock & n up::SendInput {Blind}{Home Up}
Capslock & `;::SendInput {Blind}{End Down}
Capslock & `; up::SendInput {Blind}{End Up}
Capslock & Space::
If GetKeyState("CapsLock", "T") = 1
SetCapsLockState, AlwaysOff
Else
SetCapsLockState, AlwaysOn
Return
; Capslock only, Send Escape
CapsLock::Send, {ESC}
; Capslock + b, open the gitbash
CapsLock & s::Send +{F10},Send s
;\ to |, <+\ to \
\::+\
Shift & \::Send {\}
; Capslock + w, run worktile
CapsLock & w::
Run https://worktile.com/project/4dbc6fdb5dfd49079da5c8c811b2cb8d/task
return
^`::^/
; Capslock + G
CapsLock & g::
Run C:\Program Files\Google\Chrome\Application\chrome.exe
return
; Cpaslock + -= ,send up,dowm
Capslock & =::SendInput {Blind}{PgDn Down}
Capslock & = up::SendInput {Blind}{PgDn Up}
Capslock & -::SendInput {Blind}{PgUp Down}
Capslock & - up::SendInput {Blind}{PgUp Up}
;Caplock & p , Send click
Capslock & p::Send +{Click 600, 200}
;Capslock & q ==> win down
Capslock & q::SendInput #{Down}
;Capslock & ` ==> win up
Capslock & `::SendInput #{up}
;Capslock & Tab ==> Alt Tab
Capslock & Tab::SendInput ^{Tab}
^0::#space
@dinesh0430
Copy link

Thanks, for this simple and powerful script this is very useful for me. I have seen some other scripts and this satisfies my needs as a novice vim user. I am guessing you are an advanced vim user. I could suggest some changes if you are interested.

@scottming
Copy link
Author

Welcome to type your suggestion, but I have not used windows for many years.

And I'm a vim user, I used the vim mode wether it's vscode, or idea, etc..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment