Skip to content

Instantly share code, notes, and snippets.

@itkq
Last active January 11, 2021 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itkq/b6ca2f6940896f3d235f0e2df2229d9c to your computer and use it in GitHub Desktop.
Save itkq/b6ca2f6940896f3d235f0e2df2229d9c to your computer and use it in GitHub Desktop.
realforce.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Toggle AutoHotKey
^@::
Suspend, Toggle
Return
; Left Alt --> IME off
Ctrl::
imeoff:
Gosub, IMEGetstate
If (vimestate=1) {
Send, {vkf3}
}
return
; Right Alt --> IME on
RAlt::
imeon:
Gosub, IMEGetstate
If (vimestate=0) {
Send, {vkf3}
}
return
IMEGetstate:
WinGet, vcurrentwindow, ID, A
vimestate := DllCall("user32.dll\SendMessageA", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint", vcurrentwindow), "UInt", 0x0283, "Int", 0x0005, "Int", 0)
return
RShift::Escape
; Applications you want to disable emacs-like keybindings
; (Please comment out applications you don't use)
is_target()
{
IfWinActive, ahk_exe Code.exe ; Visual Studio Code
Return 1
IfWinActive,ahk_exe wt.exe ; Windows Terminal
Return 1
Return 0
}
F13 & P::Send {Up}
F13 & N::Send {Down}
F13 & B::Send,{Left}
F13 & F::Send,{Right}
F13 & A::Send,{Home}
F13 & E::Send,{End}
F13 & O::Send,{End}{Enter}
F13 & H::Send,{Backspace}
F13 & D::Send, {Delete}
F13 & K::Send,{ShiftDown}{End}{ShiftUp}^x
F13 & Y::Send,^v
F13 & T::Send,{ShiftDown}{Left}{ShiftUp}^x{Right}^v{Left}
F13 & L::Send,^l
F13 & C::Send,^c
F13 & [::Send,{Esc}
F13 & Space::Send,^{Space}
F13 & Q::Send, ^q
F13 & 1::Send,^1
F13 & 2::Send,^2
F13 & 3::Send,^3
F13 & 4::Send,^4
F13 & 5::Send,^5
; Ctrl-Tab and Ctrl-Shift-Tab
F13 & Tab::
if GetKeyState("Shift", "P") {
Send, ^{PgUp}
} else {
Send, ^{PgDn}
}
Return
; Cmd-q
Ctrl & Q::Send,!{F4}
; Option + hjkl
#h::Send {Left}
#j::Send {Down}
#k::Send {Up}
#l::Send {Right} ; NOTE: DisableLockWorkstation = 1 (registry) is required
; Remap Ctrl-Tab to Alt-Tab
^Tab::
Send {Alt down}{Tab}
Keywait Control
Send {Alt up}
return
; Remap Ctrl-Shift-Tab to Alt-Shift-Tab
^+Tab::
Send {Alt down}{Shift down}{Tab}
Keywait Control
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment