Emacs: Xah Fly Keys π¦
What is Xah Fly Keys
xah-fly-keys.el
is a modal editing mode for emacs, like vi, but the design of key and command choice is based on command frequency statistics and ease-of-key score of key position and finger ergonomics.
Most frequently used commands have most easy keys.
If you have hand pain from using emacs, consider using Xah Fly Keys. Never need to press Ctrl+x and never need to press Meta anymore.
Xah Fly Keys is more efficient than vim.
Updates News
Video Intro to Xah Fly Keys

more videos of Xah Fly Keys:
Download
Archived Old Versions
- xah-fly-keys_old_2025-06-06.el β’ last version before major key change.
- xah-fly-keys_old_2024-04-22.el β’ version using alist for laytous, before using text diagram for layout.
- xah-fly-keys_old_emacs_27_2023-09-21.el β’ Requires Emacs 27 (date 2020)
- xah-fly-keys_old_2020-04-18.el β’ Requires Emacs 24 (date 2012)
Install from NonGNU ELPA
Alt+x package-install
RET xah-fly-keys
RET
Manual Install
Put the file xah-fly-keys.el
in ~/.emacs.d/lisp/
Put the following in your emacs init:
(add-to-list 'load-path "~/.emacs.d/lisp/") (require 'xah-fly-keys) ;; specify a layout. optional (xah-fly-keys-set-layout "qwerty") ;; (xah-fly-keys-set-layout "dvorak") ;; possible values ;; adnw (German) ;; azerty ;; azerty-be ;; bepo (French) ;; colemak ;; colemak-dh ;; dvorak ;; engrammer ;; halmak ;; koy (German) ;; minimak ;; neo2 (German) ;; norman ;; programer-dvorak ;; pt-nativo (Brazil) ;; qfmlwy ;; qgmlwb ;; qwerty ;; qwerty-abnt (Brazil) ;; qwerty-no (Norwegian) ;; qwerty-se (Swedish) ;; qwertz ;; qwpr ;; russian ;; workman (xah-fly-keys 1)
What Does Command Mode Do?
When in command mode:
- Right hand letter keys are moving cursor, in general. For example, i j k l , are arrows.
- Left hand letter keys are deleting/modifying text.
Activate Command Mode
- Alt+x
xah-fly-command-mode-activate
- Activates command mode.
By default, it has the following keys:
- Esc
- Alt+Space
- Ctrl+Space
Visual Indicator for Command Mode
When in command mode, current line is highlighted. (via hl-line-mode)

How to Find Out What a Key Do in Command Mode
- Activate command mode (press Esc)
- γSpace j vγ (
describe-key
) - press the key.
Insert Mode
When in insert mode, keys insert characters. It is essentially like Xah Fly Keys is off.
- Alt+x
xah-fly-insert-mode-activate
-
Activate insert mode.
When in command mode, f activates insertion mode.
When in command mode, Space Space also activates insertion mode.
Leader Key Sequence for Commands
You NEVER need to press Ctrl+x
When in command mode, the Space is the leader key. It begins a key sequence for all commonly used commands.
Here's example of frequently used ones.
- Space Space
xah-fly-insert-mode-activate
- Space Enter
execute-extended-command
- Space f
switch-to-buffer
- Space h
beginning-of-buffer
- Space n
end-of-buffer
- Space r
query-replace
- Space k r
query-replace-regexp
- Space i e
- open file (
find-file
) - Space i d
- list buffers (
ibuffer
)
There are about 270 commands with leader key sequence.
Which Key Mode
By default, when you press Space, available subsequent keys and their commands are displayed. (via Which Key Mode, new in Emacs 30 (date 2025) )

NEVER Need to Press Meta
Any emacs command that has a Meta (Alt) keybinding also have a keybinding without Meta in Xah Fly Keys.
For example:
- Alt+f (
forward-word
) is o while in command mode. - Alt+% (
query-replace
) is Space r while in command mode.
Standard Control Key Shortcuts
The following standard keys are supported by default. (they can be disabled.)
- Ctrl+Tab β next user buffer
- Ctrl+Shift+Tab β previous user buffer
- Ctrl+v β paste
- Ctrl+w β close buffer
- Ctrl+z β undo
- Ctrl+n β new buffer
- Ctrl+o β open
- Ctrl+s β save
- Ctrl+Shift+s β save as
- Ctrl+Shift+t β open last closed
- Ctrl+= β larger font
- Ctrl+- β smaller font
It is not necessary to use these key shortcuts. These commands all have keys that do not need Ctrl.
The only time you need to press Ctrl key are:
- Ctrl+c β for major mode commands.
- Ctrl+g β for canceling command or key.
- Ctrl+q β for
quoted-insert
. - Ctrl+h β for help.
Major Contributors
2020-04-18 Major key engine rewrite by Dan Langlois (https://github.com/DanLanglois) and Will Dey (https://github.com/wi11dey).
It prevents Xah Fly Keys from being overriden by other major or minor modes.
It does this using set-transient-map
.
