Vim

To start, let’s clear up some confusion. Vim is Vi IMproved and was started back in 1991. So what is vi. Well, vi was an editor written by Bill Joy in 1976 who co-founded Sun Microsystems. It is often tauted as a very lightweight editor and, at least historically, has been part of the emacs / vi wars where proponents of each insult the other. I use both but for different tasks. I would at least learn vim though if you are only going to learn one of the two.

Obtaining and Installing

Emacs is available for all operating systems but how you obtain it will depend on your particular one. For linux, For mac, For windows.

Usage

The major distinction for vim is that it uses modes. Specifically it uses an edit mode where you type and edit the text and it uses a command mode where you can enter commands like ‘save’, ‘search’, etc. When you open vim, you are in command mode. So if you start typing you are going to see lots of weird things. To start editing, you can just type i which stands for insert. Then you can edit as much as you like. To get out of edit mode, you can hit the ‘ESC’ button. If you want to save, you can, while you are in command mode, type :saveas filename.

Typical usage will be that you are in the terminal and you are in the directory in the terminal where your file that you want to edit is stored. Then you would type vi filename. Vim would open your file and you can go into edit more or do some command. Then when you want to save your changes you type :wq which stands for write and quit. It does both commands in that order. If you don’t want to save the changes, you can type :q! which means quit despite the fact that I haven’t saved my changes.

Commands

Here are some basic commands but if you are intrigued, I would suggest looking at some of the tutorials listed below.

Tutorials

Here are some more in depth tutorials and cheatsheets.

  • Interactive tutorial: pretty nice interactive tutorial that runs a stripped down version of vim in the browser

Leave a Reply