Use Emacs in Vi Mode

[This page is an artifact from the 1990s.]

I have long recommended Emacs in Vi mode (called VIP) to those who were moving from Vi to Emacs. Now I advocate this mode for everyone. Why? The control and meta sequences that Emacs provide for cursor motion and text manipulation will destroy your wrists. As the O'Reilly book "Learning GNU Emacs" (p. 10) says about the Emacs menu: "People who have or are at risk for carpal tunnel syndrome can avoid reaching for the CTRL key, an action known to aggravate that condition." Is it a coincidence that James Gosling, the originator of Emacs, and Richard Stallman, the major developer, both have severe wrist problems? Emacs sequences use your pinkies constantly in a strained position. Vi sequences balance the load between fingers, with the fewest possible strokes. (I don't know how Bill Joy's wrists are doing.)

Much Emacs functionality is essential, and if I had to choose, I would leave all of Vi for pure Emacs. But you can have all of both. All Emacs keystrokes and modes still function as before, since they use control and meta sequences that are distinct from Vi commands. You gain the option of using wrist-friendly Vi sequences for routine text manipulation. You can use Emacs customization to streamline Vi edit mode further. See the O'Reilly book "GNU Emacs Extensions."

In this directory you will find .emacs and .vip files to go in your home directory. I particularly like the highlighting of languages. Invoke emacs with an alias for emacs -l vip. You'll also find postscript reference cards for emacs and VIP. Elsewhere on the net you can track down a large postscript manual for VIP, but I doubt you'll need it if you know Vi already.

One feature of VIP will confuse you at first. You can switch between vi and emacs mode with a control-z, which is easy to hit by accident. The bar at the bottom of the screen will tell you which mode you are in. Fortunately, if you discover you have been typing garbage, you can hit undo u with any number of repeat . strokes. In vi mode, you can quit as usual with :wq or :q!. In any mode, you can quit with control-x, then control-c.

In your .emacs file you want to use at least the following three directives.

; Use vi mode.  Remove this line for plain emacs.
(setq term-setup-hook 'vip-mode)

; Hide because dangerous in vi mode
(global-unset-key "\e\e")

; Turn off binding of colon to eval
(put 'eval-expression 'disabled nil) 
I found most everything in my .vip file to be essential.

Emacs dot file for your home directory.
.emacs
VIP dot file for your home directory.
.vip
Color high-lighting files for C++, Java, HTML, Python, Tcl, and Perl. Put these in a subdirectory "bashdots," or change the path in the emacs file.
hilit-cpp.el
hilit-java.el
hilit-html.el
hilit-python.el
hilit-tcl.el
hilit-perl.el
VIP reference card
vip.ps.gz
Emacs reference card
emacs.ps.gz

Go back to my homepage or hotlist.