The Squirrels Are Watching

Fun with AutoHotKey

Posted in Code and Tech by andrewfong on July 1, 2009

I’m rather fond of the e text-editor. Coming from TextMate, e presents a familar environment for Windows users. The one beef I had though was the inability to configure keyboard shortcuts. Specifically, I felt Ctrl+G should be “Find Next”, like it is in so many other programs, instead of “Go to Line”.

I tried a few other editors, but they all annoyed me to no end. Habits, familiarity, and all that. So rather than wait for e to add it’s own configurable keyboard shortcuts or muck around the in source code (brief aside: the availability of the source code actually makes me pretty happy — it means I can compile an alternative to vim / emacs on *nix that I actually like), I decided to use AutoHotKey.

In short, AutoHotKey lets you write scripts that remap keyboard shortcuts as you see fit. Some (minor) programming ability required and the documentation is a little convoluted, but it still beats all the alternatives. My e remapping below the fold.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

; Start e
; Obviously, replace this path with your own
Run "C:\Program Files (x86)\e\e.exe"

; Remap hotkeys for e text editor
; Ctrl-g > find next
; Ctrl-l > Go to line
; Ctrl-p > Symbol search
; We lose project pane shortcut, but I never use this anyway

$^g::

SetTitleMatchMode, RegEx

IfWinActive, .*\s-\se$
{
  Send ^f
  return
}
Send ^g
return

$^l::

SetTitleMatchMode, RegEx

IfWinActive, .*\s-\se$
{
  Send ^g
  return
}
Send ^l
return

$^p::

SetTitleMatchMode, RegEx

IfWinActive, .*\s-\se$
{
  Send ^l
  return
}
Send ^p
return

Install AutoHotKey, save the above as something.ahk, and use that as your executable instead of the default e one, and you’re good to go!

Advertisements

One Response

Subscribe to comments with RSS.

  1. […] I blogged about this before, but one of my top annoyances with Windows is the inability to change the keyboard shortcuts. AHK […]


Comments are closed.

%d bloggers like this: