I just bought a new laptop. Sadly, it doesn’t have the keys Home
or End
, keys I use all the time while writing code. It’s the kind of feature that’s annoying, but not enough to make me not buy the laptop. Here’s how I get back the functionality I need.
1. Install AutoHotkey
AutoHotkey is a program for writing macros in Windows, letting you bind an action to a key event. This is precisely what we want, since it allows us to bind keys to the Home
and End
buttons.
2. Script the Keys
Here’s the script I wrote to emulate the most common actions I do that use the Home
and End
keys:
;
; END Key Emulation
;
!\::
SendInput {End}
return
!+\::
SendInput +{End}
return
^!\::
SendInput ^{End}
return
^!+\::
SendInput ^+{End}
return
;
; HOME key emulation
;
!'::
SendInput {Home}
return
!+'::
SendInput +{Home}
return
^!'::
SendInput ^{Home}
return
^!+'::
SendInput ^+{Home}
return
Copy this into your AutoHotkey.ahk
, the default script.
Explanation
This scripts the Alt+\
button (alt + backslash) to the End
key and the Alt+'
button to the Home
key. It also covers key combinations such as Ctrl+Home\End
or Shift+Home\End
. These are quite useful commands for moving to the beginning/end of an entire document or to select till the beginning/end of the line. I use the commands all the time while programming in Sublime Text, and I hope they can help others.