The vi Editor


In this chapter, we'll cover the following topics:

  • Regular expressions

  • vi

Many UNIX users have a Graphical User Interface (GUI) through which they access their UNIX system. The Common Desktop Environment (CDE) is the most commonly used GUI on UNIX systems. It is based on the X Windows System and Motif, which together provide an advanced windowing environment. Chapter 14 in this book is devoted to CDE. Most UNIX GUIs provide a graphical editor. Despite the fact that these graphical editors are a standard part of most GUIs, the visual editor, vi , remains the most popular UNIX editor. With many fine graphics-based editors as a standard part of most UNIX GUIs and a plethora of editors available as part of personal computer windowing environments, why am I covering vi ? The answer is two-fold. First, not everyone using a UNIX system has access to a graphics display and may therefore need to know and use vi . Because vi comes with most UNIX-based systems and is a powerful editor, many new UNIX users end up using and liking it. Second, vi has traditionally been thought of as the UNIX editor. Few UNIX users have not used vi . This fact does not mean that it is everyone's primary editor; however, virtually all UNIX users have had some experience with vi .

Also, a line editor called ed comes with many UNIX systems. It is now seldom used because vi is a screen editor. Also available is an enhanced version of ed called ex. vi is much more widely used than either of the line editors, so I'll cover only vi in this chapter.

I'll cover the basics of using vi in this chapter. You can experiment with what is covered here, and if you really like it, you can investigate some of the more advanced features of vi . A quick reference card summarizing all the vi commands covered in this chapter is included with this book.

The following table is a list of tables in this chapter that summarize some of the more commonly used vi commands by function:

Table Number

vi Function

Expr

Regular Expressions

Introduction

Modes and Notations in vi

1

Starting a vi Session

2

Cursor Control Commands in vi

3

Adding Text in vi

4

Deleting Text in vi

5

Changing Text in vi

6

Search and Replace in vi

7

Copying in vi

8

Undo in vi

9

Saving Text and Exiting vi

10

Options in vi

11

Status in vi

12

Positioning and Marking in vi

13

Joining Lines in vi

14

Cursor Placement and Adjusting Screen in vi

15

Shell Escape Commands in vi

16

Macros and Abbreviations in vi

17

Indenting Text in vi

18

Shell Filters in vi

19

Pattern Matching in vi



HP-UX 11i Systems Administration Handbook and Toolkit
HP-UX 11i Systems Administration Handbook and Toolkit (2nd Edition)
ISBN: 0131018833
EAN: 2147483647
Year: 2003
Pages: 301

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net