Skip to content

Instantly share code, notes, and snippets.

@6david9
Last active December 20, 2021 15:51
Show Gist options
  • Save 6david9/21ef0fbbdbbf56a3c7f44a3b6c267c7e to your computer and use it in GitHub Desktop.
Save 6david9/21ef0fbbdbbf56a3c7f44a3b6c267c7e to your computer and use it in GitHub Desktop.
simulate emacs nativate operations using auto hot key
#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.
SetCapsLockState, AlwaysOff
+!m::SendInput +^m
!s::SendInput ^s
!a::SendInput ^a
!f::SendInput ^f
!c::SendInput ^c
!x::SendInput ^x
!v::SendInput ^v
!z::SendInput ^z
!/::SendInput ^/
!n::SendInput ^n
!t::SendInput ^t
!w::SendInput ^w
!l::SendInput ^l
^u::Goto, Deletecurrentline
Alt & Backspace::Goto, Deletecurrentline
#IF GetKeyState("CapsLock", "P")
Alt & f::SendInput ^{Right}
Alt & b::SendInput ^{Left}
Alt & p::SendInput ^{Home}
Alt & n::SendInput ^{End}
return
#IF GetKeyState("CapsLock", "P")
a::SendInput {Home}
e::SendInput {End}
b::SendInput {Left}
f::SendInput {Right}
p::SendInput {Up}
n::SendInput {Down}
h::SendInput {Backspace}
Backspace::SendInput ^{Backspace}
d::SendInput {Delete}
l::SendInput ^l
w::Goto, DeleteWord
u::Goto, DeleteCurrentLine
return
DeleteWord:
SendInput ^{Backspace}
return
DeleteCurrentLine:
SendInput {End}
SendInput {Shift Down}{Home}{Shift Up}
SendInput {Delete}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment