/emacs.ahk

An autohotkey script that allows you to use emacs-like key bindings on Windows environment

Primary LanguageAutoHotkey

emacs.ahk

This tiny script allows you to use the emacs-like key bindings on Windows, which is written in AutoHotkey (AHK) language. The maintainer has used this script since 2020-06 and has verified that it works effectively for various kinds of applications.

Supported keybindings

Keybinding Emacs Lisp Function
C-Space set-mark-command
M-h set-mark-command
C-x C-f find-file
C-x C-s save-buffer
C-x C-c kill-emacs
F5 kill-emacs
C-d delete-char
M-d delete-word
C-h delete-backward-char
C-k kill-line
C-o open-line-emacs
C-g quit
C-j newline-and-indent
C-l newline-emacs
C-m newline
C-l newline_emacs
M-i indent-for-tab-command
C-i indent-for-tab-command-invert
C-s isearch-forward
C-r isearch-backward
C-w kill-region
M-w kill-ring-save
C-y yank
C-/ undo
C-? redo
C-a move-beginning-of-line
C-e move-end-of-line
C-p previous-line
C-n next-line
C-f forward-char
C-b backward-char
M-f forward-word
M-b backward-word
C-v scroll-down
M-v scroll-up
win-= text-scale-increase
win-- text-scale-decrease
F11 maximize or restore window
C-z, j end-of-buffer
C-z, k beginning of buffer
C-x, h mark-whole-buffer
C-c, d duplicate of current line
C-x, C-; toggle the comment of line
  • Customized by Eason Huang

Toggle Input Method by Shift Key

use Shift key for input method switch

Update to AutoHotkey V2

Now this script only works for V2, tested on v2.0.10

Usage

run emacs.ahk under AutoHotkey v2.0

Automatic launch at Windows startup

Use PowerShell to create symbolic link

Syntax:

New-Item -ItemType SymbolicLink -Path "Link" -Target "Target"

Example:

 cd $Env:USERPROFILE
 clone https://github.com/Eason0210/emacs.ahk
 ni -ItemType SymbolicLink "$Env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\emacs.ahk" -Target "$Env:USERPROFILE\emacs.ahk\emacs.ahk"