An Introduction to vi

First, some language: there are three common versions of vi. vi is the simplest, and will open directly in your terminal, not as a separate window. vim is "vi improved," and (most crucially) has syntax highlighting. gvim is "graphical vim," and will open a new window with clickable buttons that copy, paste, save, and all sorts of other things that are helpful when you're first getting started. All three are colloquially referred to as "vi" (pronounced vee-eye).

The goal of vi is to never use the mouse or arrow keys - if you are, you're not using it right. So, you need keyboard shortcuts for everything you might want to do (copy, paste, save, open a new file, move around, etc.). As a result, vi has two modes: "insert mode," which is when you're actually typing text into your file, and "normal mode," which is when all your keys get remapped to allow you to do everything else you might want to do. As you might guess by the names, when you're good at vi, you spend more time in "normal mode" than actually typing!

vi has a learning curve which can seem steep. However, it will save you a LOT of time in the long run. A LOT.

Below are some of the shortcuts I use most often to help get you started. This is a very, very small subset of the things you can do in vi. Start with even a subset of these which seem most useful to you, and add more as you get better.

Going from insert mode to normal mode

Going from normal mode to insert mode

Moving around the file

Making edits

Saving/opening files