[Talisman]
search
TALISMAN general Information
Unix server
Emacs & Vi

Emacs & Vi


These two editors have long been considered the contenders in the holy war of Emacs versus Vi. Despite the two group's tendency to harass each other, research in classrooms where both were taught has shown a nearly even split in which editor students eventually preferred, even when they had facility in both. In normal situations, people tend to stick to whichever they learned first. For those who do know both, emacs and vi tend to often both be used, often at the same time, taking advantage of their differences.

The differences for starting users:

EMACS has a basic command set (keys to hit to do things) which is largely based on mnemonics like n for Next, p for previous, and relies on modifier keys like control, meta, and so forth to distinguish commands from actual text being entered. The emacs command set flexes very well across different keyboard layouts, like qwerty versus dvorak, since commands aren't arranged by keyboard position. However, there must be a convenient control key for emacs to be usable. The emacs command set, actually a set of keybindings to the underlying commands, is mostly mnemonic but give a bit of an impression of having grown organically rather than having been planned.

Emacs has long been able to edit raw binary data, although it once had difficultly with files more than several (8? 24?) megabytes in length.

Emacs is especially convenient for users who like to edit multiple files in one editor with multiple windows visible simultaneously, although by no means restricted to such use.

VI has a basic command set with is significantly based on a row of four keys on the keyboard, one which is not the right-hand home row of jkl; but rather shifted one key to the left. This can be irritating to touch typists and difficult on dvorak keyboards, since the basic key row in qwerty isn't a row in dvorak. Vi relies on mode switching to distinguish commands from text entry, with several single-letter commands to enter modes, and the escape key used to return to command mode. Vi expects that there is an easily usable escape key, although several work arounds are possible if a control key is present. The vi command keys are a bit cryptic, but give an impression of being planned out and are fairly self-consistent.

As of 2010, vi still has trouble with binary (non-text) files, although this is a niche use.

Vi is especially convenient for quick edits of files with line-oriented data, although by no means restricted to such use.

Emacs-specific resources

  • The Emacs Hints memory card
  • Emacs has a built-in tutorial available through C-h t, which means:

    1. hold down the control key
    2. tap h
    3. release the control key
    4. tap t
    5. ... welcome to the tutorial!

Online resources


Vi-Specific Resources


Emacs and Vi editing commands compared

Emacs commandFunctionvi command
Control-BMove back one characterh
Control-FMove forward one characterl
Control-PMove to previous linej
Control-NMove to next linek
Control-AMove to start of line^ or 0
Control-EMove to end of line$
Control-DDelete characterx
Meta-B Move back one wordb
Meta-F Move forward one wordw
Control-VMove to next pageControl-F
Meta-V Move to previous pageControl-B
Meta-<Move to start of file1G
Meta->Move to end of fileG
Meta-D Delete worddw
Control-KKill (delete) to end of lined$
Control-YYank (paste) killed textY or yy
Control-X Control-FRead file:r
Control-X Control-SSave file:w
Control-X Control-CExit:q or :q! or :wq or ZZ
If this site was helpful, feel free to tip the webmaster