Last active
August 1, 2022 17:38
-
-
Save jcherven/2cd73b76e8a3dcc588f5473e64722472 to your computer and use it in GitHub Desktop.
Autohotkey (Windows) script for binding Readline/Emacs cursor and editing keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Requires installation of autohotkey. | |
;; To run on login, the script can be placed in the | |
;; "shell:startup" or "shell:common startup" folder | |
; Prevent Alt-modified keys from triggering Windows menus | |
~Alt:: | |
KeyWait, Alt | |
return | |
~LAlt Up:: | |
if (A_PriorKey = "Alt") | |
return | |
return | |
~RAlt Up:: | |
if (A_PriorKey = "Alt") | |
return | |
return | |
; Binding conflict concessions | |
; Re-bind the common find shortcut(ctrl-f) to ctrl-shift-f | |
^+f::Send ^f | |
; Re-bind the common select all shortcut(ctrl-a) to ctrl-shift-a | |
^+a::Send ^a | |
; Re-bind the common close tab shortcut (ctrl-w) to ctrl-shift-w | |
^+w::Send ^w | |
; Character movements | |
$^a::Send {Home} | |
^e::Send {End} | |
^b::Send {Left} | |
$^f::Send {Right} | |
!f::Send ^{Right} | |
!b::Send ^{Left} | |
; Line Movements | |
^n::Send {Down} | |
^p::Send {Up} | |
; Line Editing | |
^h::Send {Backspace} | |
^d::Send {Delete} | |
; Delete everything after the cursor | |
^k::Send +{End}{Delete} | |
; Delete everything before the cursor | |
^u::Send +{Home}{Delete} | |
; Delete the word before the cursor | |
$^w::Send +^{Left}{Delete} | |
; Delete previous word | |
!Backspace::Send +^{Left}{Delete} | |
; Reverse mouse scrolling closer to MacOS | |
#HotkeyInterval 1000 | |
#MaxHotkeysPerInterval 500 | |
WheelUp:: | |
Send {WheelDown} | |
Return | |
WheelDown:: | |
Send {WheelUp} | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment