A the vi editor, Getting started, Preparing to use vi in the oss environment – HP NonStop G-Series User Manual
Page 155: Appendix a: the vi editor
A The vi Editor
The vi text editor is well suited for the day-to-day editing tasks of most computer users. Using vi,
you can quickly and easily open a file, edit it, and save the results. The vi editor operates basically
the same way on all UNIX systems, so if you’ve used vi on a UNIX system, you should be able
to immediately start using vi in the OSS environment. While vi does not have some of the features
of proprietary text editors and word processors, it is a full-featured text editor with the following
major features:
•
Fast processing, especially on startup and global operations
•
Full-screen editing and scrolling capability, unlike the line editor ed, on which vi is based
•
Separate text entry and edit modes
•
Global substitution and complex editing commands
The vi editor works in two modes: command mode and input mode. Command mode is the mode
vi
starts in. In command mode, the characters you type are treated as commands for manipulating
the text. In input mode, the characters you type are actually placed into the file as text.
This appendix demonstrates the basic features of vi. When you finish this appendix, you will be
able to do the following:
•
Open or create a file for editing
•
Move the cursor within the file
•
Enter new text into the file
•
Change existing text within the file
•
Search for simple strings within the file
•
Move and copy text
•
Make simple global substitutions in the file
•
Write all or part of the text to a file
•
Delete, move, or copy blocks of text
•
Customize your editing environment
This appendix provides only an introduction to the features of vi. For more information, see the
vi(1)
reference page either online or in the Open System Services Shell and Utilities Reference
Manual. You can also read one of the many commercially available books that describe vi in
depth.
This appendix is divided into three subsections. The first subsection gets you started using vi. The
second subsection shows you some advanced techniques for speeding up your work. The third
subsection shows you how to use the ex commands that underlie vi.
Beginning with the J06.14 and H06.25 RVUs, the Vi IMproved text editor, vim, is available in
the OSS Core Utilities product (T1202). For information about the OSS Core Utilities, see
Core Utilities User Commands (page 185)
.
Getting Started
This subsection shows you how to open a file with vi, move around within it, create some text,
change that text, and save your changes.
Before starting vi, you must take some preliminary steps to use vi in the OSS environment .
Preparing to Use vi in the OSS Environment
There are two obstacles to the correct functioning of vi in the OSS environment. The first is that
vi
was designed to run on a VT100 terminal; any other terminal might cause vi to function
improperly. The second obstacle has to do with the way vi was implemented on OSS. This can
Getting Started
155