Ergoemacs-vi Mode

, , …,

now i've done it. A ergonomic based vi-like modal mode for programing, the ErgoEmacs-vi mode!

this is a modal edit method, like vi, but the key/command map is based on command frequency and ease-of-press key positions. The keymap is largely the same as in ergoemacs-mode.

if you are a Dvorak Keyboard Layout user, and uses the Truly Ergonomic Keyboard, then this works out of the box for you. It is compatible with ergoemacs-mode, so you can use them both at the same time.

if you are not a dvorak user, you might need to adjust the key choices. I've been using it since .

Download at (you also need function definitions in the same dir.)

Truly Ergonomic Keyboard Configuration

here's my current Truly Ergonomic Keyboard configuration.

xah truly ergonomic keyboard 207 config 2013-10-01
xah Truly Ergonomic Keyboard config

note the ↖ Home and ↘ End keys. They are used to switch between command/insertion modes.

Also note the F13F17 keys. They are used as single key or key sequence starting-keys. Majority are used in emacs, others are system-wide, mostly for controlling windows & tabs.

the “Apps” on the left space bar position means the ▤ Menu key. It is used as starting-key for key sequences, for vast majority of emacs's commands. The Tab ↹ key in the middle is also a starting-key for key sequences, for mode-specific commands.

Setting Up Keys on Mac

On Mac OS X, you can set up the right ⌘ Cmd key or right ⌥ Opt to be ▤ Menu key. You can also set the Caps Lock to be ↖ Home. See: Mac OS X: Keyboard Layout, Keymapping, Keybinding, Software ⌨

Why I Created It

here's some detail about why i created it.

i'm a QWERTY typer since ≈1987. Switched to Dvorak in ≈1993. Started to use emacs in 1997, live in it by 1998. Used default GNU keybinding up to 2006. Started to experience minor RSI discomfort a few times since 2010. 〔☛ Summary of My Typing & RSI Experience 1992 〜 2013

i always regarded the vi modal ways a hack of the hack of the unix lineage. 〔☛ History of Emacs & vi Keys〕 I'll never touch it. But starting in 2010, i had lots thoughts about keyboard efficiency, and it occurred to me the modal way is actually more efficient, for programers.

the reason is, that on average, ≈50% of key-strokes of programers are actually not data-entry (that is, 50% are actually moving cursor, copy/cut/delete text, etc.) 〔☛ Emacs's Command Frequency Statistics〕 That means, if using modal ways, 50% of the time you don't have to press key combinations to execute commands, just a single key for each command. So, the 50% of time when you call commands, each command you save about 1 or 2 key-stroke, so in total you save about 50% × 50% = 25% of key-strokes. The trade-off is that you have to constantly switch modes, which means adding a key stroke every time you do so. Overall, i estimate it saves you in the ball-park of 10% to 20% of key strokes.

i've been wanting to create and experiment with vi modal ways since 2010. While there's viper-mode (which is a vi-emulator) and there's evil-mode (which is based on vim (a more advanced vi)), but their key/command choices is largely historical, not a clean design based on efficiency.

see also: on vi Keybinding vs Emacs Keybinding

ergoemacs-mode Has Modal Feature Too

this ergoemacs-vi mode works well when used with ergoemacs-mode together. ( update. Actually, lots has changed in both, and i haven't used them together for 2 months now.)

Note that in ergoemacs-mode, it also has a modal way by itself. You press any of the key to move cursor, then you don't need to hold Alt anymore, you can keep pressing the nav keys to move cursor. This mode will exit when you press some other key-combo that is not a cursor moving command. You need to turn it on, like this:

;; turn off ErgoEmacs repeat move without holding Alt feature
(setq ergoemacs-repeat-movement-commands 'nil)

;; set ErgoEmacs repeat movement. Example, on QWERTY, once you press any of 【Alt+i】 or 【Alt+j】 or 【Alt+k】 or 【Alt+l】, then any i j k l key will move cursor, no need to hold Alt anymore. Type any other key automatically exit.
(setq ergoemacs-repeat-movement-commands 'all)

i haven't actually used this ergoemacs-mode modal way, but now i think it has strong advantage, because you don't need a separate key to switch between insert/command modes (in other words, the mode switching is transparent). (but on the TECK keyboard, it may not be suitable because there's no large Alt key for both hands. You could set the 2 keys on the side of the home row to Alt, but it's not so good to use your pinkies to hold them all the time.)

If you use any of the Ergonomic Keyboards that has large Alt keys, such as Microsoft Ergonomic Keyboard or Kinesis Contoured then, it'll work well.

blog comments powered by Disqus