CSB Home | Search | Table of Contents | General Information |
Before you start a vi session, make sure your keyboard has an escape key ( <ESC> ). The VT terminals need to have one setup for them.
To start a session in vi type:
vi 'and the file name'
where 'filename' is the name of the ASCII file you would like to edit
or new file name you would like to create
vi is the ``universal UNIX editor''. Once you learn how to use the vi
editor, you can use it on ANY UNIX machine.
A summary of the vi commands is available online
The specific key strokes involved to actually use vi can be found in
the man pages (man vi)
Here is a brief description of groups of vi commands and their functions:
Paging Commands <CTRL/F> Pages forward one screen. <CTRL/B> Pages back one screen. <CTRL/D> Pages down half screen. <CTRL/U> Pages up half screen. Cursor Positioning Commands arrows Moves cursor in the direction of the arrow <RETURN> Moves cursor to beginning of next line. 0 Moves cursor to beginning of current line. $ Moves cursor to end of current line. <SPACE> Moves cursor forward one character. /pattern Moves cursor forward to next occurrence of "pattern" ?pattern Moves cursor backward to next occurrence of "pattern" n Repeats last / or ? pattern search. :n Moves to line number n Text Insertion Commands i Inserts text before cursor. Terminated by <ESC>. o Opens new line below the current line for text inser- tion. Terminated by <ESC>. <ESC> Stops text insertion. Text Deletion Commands dw Deletes current word. x Deletes current character. dd Deletes current line. P Puts back text from the previous delete. Buffer Usage Commands n yy Yanks n lines to the buffer. Default is current line. When a line is Yanked, it copies the line to a buffer and leaves the original lines within the text file. n p Puts n yanked text lines from the buffer, after the cursor. Exiting vi :wq Writes changes to current file and quits edit session. :q Quits edit session (no changes made).
Once you start editting a file using vi (vi filename), you can use the
cursor movement and paging commands to move around your file. You can
also use the text delete and buffer commands to remove or move pieces
around.
When you want to insert text, you MUST type "i". When you
are done inserting text, you MUST hit the escape key. If you try using
the arrows keys or other cursor movement commands, and have not hit the
escape key when inserting, you will get funny characters in your file.
When you are done editting your file, simply type ":wq", to
write and quit the vi session.
Please read the manual pages (man vi) for a complete list on vi
functions.
CSB Home | Search | Table of Contents | General Information |
Center for Structural Biology (www.csb.yale.edu),
Yale University (www.yale.edu)
Contact: webadmin(at)mail^csb^yale^edu Last Modified: Wednesday, 31-Mar-1999 10:38:53 EST by P. Fleming |