Emacs-like keybinds in Windows using AutoHotKey

TL;DR

Realize easily Emacs-like keybinds in Windows such as Ctrl-n, Ctrl-p etc.

People who love Linux unconciously type those against Windows and get frustrated.

Let’s see how AutoHotKey works for it.

Confirmed environments

  • OS: Windows 10 Home
  • AutoHotKey: 1.1.29.01

No version problems will exist because only basic functions are used.

Install AutoHotKey

AutoHotKey

Just install from .exe!

Edit AutoHotKey script

After launch, its icon will be present in mini-icon area of the task-bar.
Right click it and select “Edit This Script”.

1
2
3
4
5
6
7
8
9
10
11
# [KEYBIND]::Send [COMMAND]

^h::Send {Backspace}
^a::Send {Home}
^e::Send {End}
^n::Send {Down}
^p::Send {Up}
^b::Send {Left}
^f::Send {Right}
^k::Send +{End}{Delete}
^d::Send {Delete}

Those setting imitates Emacs keybinds.

  • ^ represents Ctrl
  • Send literally sends the following command
  • {Home}, {Left} etc. are commands. Upper/lowercase is ignored inside {}

Explanation about Ctrl-k; + represents Shift modifier thus +{End} selects area from the current position to the end of line.
Then, {Detele} it.

Reload the script

Save the script, then right click the mini-icon again and “Reload This Script”.
You’ll find it working.

More information