Text Editor Basics

[Genhelp | Program Manual | User's Guide | Data Files | Databases | Release Notes ]

Table of Contents

Overview

Using vi

Before You Begin

Opening a New or Existing File

Editing a File

Navigating within a File

Editing Text in a File

Inserting Changes in a File

Saving Your Work

Ending a vi Session

Getting Help with vi


Overview

[ Top | Next ]

This appendix is provided for users unfamiliar with the UNIX text editor vi. It provides the very basics to get you started using the vi editor.

You will find the following information in this appendix:


Using vi

[ Previous | Top | Next ]

vi (pronounced vee-eye) is a screen editor supplied with most UNIX systems. Using vi you can create a new file, open an existing file, and insert or modify text in a file. For more information on vi, see the documentation for your particular UNIX operating system.

Before You Begin

[ Previous | Top | Next ]

Before you begin using vi, you must tell it what type of terminal you are using.

To set your terminal type for using vi:

Type the following.

csh

Example

% set term=terminal_type

% set term=vt100

 

ksh

Example

% TERM=terminal_type

% TERM=vt100

% export TERM

% export TERM

Opening a New or Existing File

[ Previous | Top | Next ]

To open a new or existing file in vi:

Type % vi filename, where filename is the name of the new file you want to create or the name of an existing file. For example, if you opened a new file, it would look like the following.

The tilde (~) along the left margin means that the file doesn't have enough content to fill up the screen.

When you start vi, it prints the filename, number of lines, and number of characters at the bottom of the screen. For example, if you opened an existing file, it would look like the following.

Editing a File

[ Previous | Top | Next ]

Note: The following guidelines are intended to get you started using vi; they instruct you on how to do simple editing. vi also offers more sophisticated editing. For more information, see the documentation for your particular operating system of UNIX.

In vi, there are two modes of operation: command mode and insert mode.

In command mode you move the cursor around the file, positioning it where you want to make your edits. There are commands to move the cursor forward, backward, left, and right, as well as commands to delete a character or line of text and commands to place you in insert mode.

To enter new text into a file, you must be in insert mode. An important fact to remember about insert mode is that commands that are available in command mode are unavailable in insert mode (except <Esc>). For example, to move the cursor to the left, you press the h key in command mode. However, in insert mode, pressing h inserts the letter h.

To get out of insert mode and back to command mode, press <Esc>. The <Esc> key is defined as <Ctrl> [ (left square bracket) on some computers. Ask your system manager for help if you are unable to locate the <Esc> key.

If you are unsure of what mode you are in, press <Esc> a few times to ensure you are in command mode.

Navigating within a File

To move the cursor around in the file in command mode:

Choose from the following.

Editing Text in a File

To edit text in the file in command mode:

Choose from the following.

Inserting Changes in a File

To insert changes in the file:

You first must switch from command mode to insert mode. Choose from the following.

Note: Press <Esc> to leave insert mode and return to command mode.

Saving Your Work

[ Previous | Top | Next ]

If you are editing a long file and you are sure about the changes you have made, it is a good idea to save your changes from time to time as you work.

To save your work without quitting:

Make sure you are in command mode and type :w.

Ending a vi Session

[ Previous | Top | Next ]

To end a session with vi:

Make sure you are in command mode and choose from the following.

Getting Help with vi

[ Previous | Top ]

To display online help for vi:

Type % man vi at the operating system prompt. A help screen appears.

Press the <Space Bar> to advance through the text one screen at a time. To exit from online help, press q.


[Genhelp | Program Manual | User's Guide | Data Files | Databases | Release Notes ]


Technical Support: support-us@accelrys.com, support-japan@accelrys.com,
or support-eu@accelrys.com

Copyright (c) 1982-2005 Accelrys Inc. All rights reserved.

Licenses and Trademarks: Discovery Studio ®, SeqLab ®, SeqWeb ®, SeqMerge ®, GCG ® and, the GCG logo are registered trademarks of Accelrys Inc.

All other product names mentioned in this documentation may be trademarks, and if so, are trademarks or registered trademarks of their respective holders and are used in this documentation for identification purposes only.

www.accelrys.com/bio