I used to use Emacs for everything, and I loved it. You could do absolutely everything really efficiently from the keyboard using a number of arcane key combinations, and once the learning curve had been overcome you could absolutely fly through your work.
Now I use Visual Studio for my coding work, MS Word for documentation, and NotePad++ for everything else, I find myself wishing that I didn’t have to move positions on the keyboard to move the cursor, delete characters and words, and do basic document navigation. I know VS.NET has Emacs key bindings available, but I find that their incompleteness means I have to mentally figure out whether to use Windows or Emacs shortcuts. This is especially difficult when switching between applications.
So I decided to whip up a quick AutoHotKey script that reproduces the basic Emacs document navigation key bindings, sticking to the shortcuts that don’t interfere too much with standard Windows shortcuts (for example, I left Ctrl-V alone :)). You can toggle “Emacs Mode” on and off using the CapsLock key, and because it uses AutoHotKey to translate key strokes, it works everywhere your keyboard does :). I’ve been using it for months and found it quite useful, so I thought I’d put it online before I lose it. :)
You can download the script from here [ZIP]. You’ll also need AutoHotKey. I’m far from an expert on AutoHotKey, so feel free to comment or email if you find any problems with the script.
Key bindings
The keys mapped by the script are described below. The mappings aren’t perfect, they simply translate Emacs keys into similar Windows key combinations. Because different applications implement concepts like “next word” differently, sometimes you get results that are slightly different to expected. C is Control, M is meta key (Alt).
CapsLock | Toggle Emacs mode on/off |
C-p | Previous line (move up) |
C-n | Next line (move down) |
C-f | Forward one character (move right) Note: conflicts with normal "find" shortcut |
C-b | Back one character (move left) Note: conflicts with normal "bold" shortcut |
M-f | Forward one word |
M-b | Back one word |
C-a | Start of line Note: conflicts with normal "Select all" shortcut |
C-e | End of line |
C-< | Start of page |
C-> | End of page |
C-_ | Undo |
C-d | Delete character after cursor |
M-d | Delete word after cursor |
M-Del | Delete word before cursor |
C-k | Kill line |
C-w | Cut region |
M-w | Copy region |
C-y | Paste (no kill ring, so don’t get full Emacs yank ability) |
If you want to use regular CapsLock functionality, try holding down Shift while pressing CapsLock. For me at least, this lets me toggle CapsLock on and off without being caught by the script.