Posted by: kurtsh | November 3, 2013

HOWTO: Remap Ctrl-LeftArrow to Home (and Ctrl-RightArrow to End)

I’ve been using the Sony VAIO S for a while now and one of the things I really liked about it was that when you typed “Fn-LeftArrow” it sent you to the beginning of a text line.  Conversely if you typed “Fn-RightArrow” it sent you to the end of a text line.

When I moved to my Lenovo ThinkPad X1 Carbon Touch, I lost that functionality.  The Fn-LeftArrow & Fn-RightArrow do absolutely nothing.  In fact, I can’t even capture the scan code for those key presses, so I had to think of an alternative.

So how does a guy replicate that functionality?  Using AutoHotKey.

imageWHAT IS AUTOHOTKEY?
AutoHotKey is a freeware piece of software for Windows XP/Vista/7/8/8.1 that allows you to map a keystroke to a specific instruction, script, or another key entirely.  It runs in the SystemTray and basically watches for keystrokes, intercepts them, and does what you want instead.

  • The upside is that it’s extremely powerful because it allows you to remap & program keys to do almost anything.  For example, you can program CTRL-ALT-M to go to http://www.microsoft.com.
  • The downside is that this isn’t for mere mortals.  The tool requires that you write a script that maps key names, scan codes or virtual key names to actions or other keystrokes.  It’s not hard to understand for IT professionals but it’s probably as foreign as Swahili to most end users.

For example, this is the script that I use to map Ctrl-LeftArrow to Home & Ctrl-RightArrow to End.  (It also maps Ctrl-Up to PgUp & Ctrl-Down to PgDown) Note that this isn’t the same thing as Fn-LeftArrow & Fn-RightArrow but it’s close enough for me since the Fn & Ctrl keys are right next to each other.

; Kurt’s Mods here
^Left::Send {vk24}
^Right::Send {vk23}
^Up::PgUp
^Down::PgDn

When you install AutoHotKey, it automatically creates a “starter” script called “AutoHotKey.ahk” in your Documents directory that is automatically loaded every time you run AutoHotKey.  This script needs to have the following done to it:

  1. Copy the above text & paste into the AutoHotKey.ahk file
  2. Comment out all the other text by placing a “;” before each uncommented line

If you run AutoHotKey, it should automatically remap the Ctrl-LeftArrow keystroke to the Home key & the Ctrl-RightArrow keystroke to the End key.


Categories

%d bloggers like this: