Emacs: Xah Fly Keys ๐ฆ
What is Xah Fly Keys
Xah Fly Keys is more efficient than vim, or any keybinding set in history.
xah-fly-keys.el
is a modal editing mode for emacs, like vi, but the design of key/command choice is based on command frequency statistics and ease-of-key score. 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.
Video Intro to Xah Fly Keys
more videos of Xah Fly Keys:
Download
Archived Old Versions
- 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 (Released 2020-08)
- xah-fly-keys_old_2020-04-18.el โข Requires Emacs 24 (Released 2012-06)
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:
- Alt+Space
- Ctrl+Space
- Home
- F8
- Escape (only when emacs running in graphical user interface, not in terminal)
- โค Menu (Keyboard Menu Key)
Visual Indicator for Command Mode
When in command mode, the cursor shape is a black rectangle โฎ (Does not work in some text terminal), and the first character in Mode Line displays lowercase c.
How to Find Out What a Key Do in Command Mode
To find the command name of a key, switch to command mode
, then
ใSpace j v ใ
(describe-key
)
, then press the key. (try it now, as you will do this frequently when learning.)
Insert Mode
When in insert mode, keys insert characters. It is essentially like Xah Fly Keys is off. (in some emacs major modes, letter key may do something special, e.g. in dired, m marks a file.)
- 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.
Visual Indicator for Insertion Mode
When in insert mode, the cursor shape is a I-beam โถ (does not work in some text terminal) and the first character in Mode Line displays i.
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 200 commands with leader key sequence. Most frequently used commands have 2 keys (counting the leader key). Other commands have 3 keys. Some rarely used have 4.
Show All Leader Keys
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.