vim

vim(1) is a text editor that can be used from a terminal. vim is a very powerful editor and has many useful functions. In this tutorial I will go over two of vim’s modes, namely insert mode and command mode. vim also has other modes but for now we will focus on those two.

Getting Started with vim

In order to open a file using vim all you need to do is type the following in a terminal window:

vim filename
where filename is the name of the file you want to edit. You can also just type vim. Note that if you open vim this way, it will open a default vim file. In order to save your work to a specific file, you will have to specify the filename when you save it. This tutorial will go over saving files later.

As mentioned above, vim has many modes, but we will focus on two of them: insert mode and command mode.

Useful vim Commands

I put together a short list of useful vim commands. To use these commands, you have to be in command mode.

More Information

The CSIF machine have a command that will bring up a longer tutorial; just run

vimtutor
Another quick and simple tutorial can be found at http://heather.cs.ucdavis.edu/~matloff/vim.html

Credit

This was written for ECS 30, Programming and Problem Solving, in Fall 2015 by Jonathan Vronsky, and modified slightly by Matt Bishop.


UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: [email protected]
ECS 36A, Programming and Problem Solving
Version of September 20, 2019 at 9:18PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh