Professional Documents
Culture Documents
What is vi?
The fundamental UNIX editor is called vi. It is a primitive editor, but it will be found on every UNIX system,
and works well when logging in remotely from home. There are just a few commands that one needs to learn
at first, and they will be sufficient to write simple files. For more advanced features, consult some of the
handouts and books available in the CS lab.
The Basics of vi
There are essentially three Modes in vi, the Insert Mode where one is typing in new text, the Edit Mode
where one is modifying text that is already there, and the Command Mode where one is interacting with the
operating system with actions like reading and writing files.
Most of the commands require just a simple letter or two, but be careful to note that vi is case sensitive, and
capital letters do different things from lower case letters. It is not necessary to learn all of these commands,
but eventually they will become second nature. The basic operations needed to create a file are related to
each of those modes, so let's look at them separately.
Letter Action
EDIT Mode
- Generally for moving the cursor and deleting stuff.
In the Edit Mode, the keys do not type letters, but do other actions such as cursor movement, deletions,
copying lines, etc.
https://www.tjhsst.edu/~dhyatt/superap/vi.html 1/3
7/7/2017 Getting Started with vi
Modifying Text
r Replaces the character under the cursor with the next thing typed
p Puts the yanked text on the line below the cursor (lower case p)
Note: If vi is already in the input mode, text from that or another window may be
highlited using the left mouse button, and copied into place by pressing the middle
mouse button.
https://www.tjhsst.edu/~dhyatt/superap/vi.html 2/3
7/7/2017 Getting Started with vi
Letter Action
https://www.tjhsst.edu/~dhyatt/superap/vi.html 3/3