Chapter 5. Introducing the ex Editor
If this is a book on vi, why would we include a chapter on another editor? Well, ex is not really another editor. vi is the visual mode of the more general, underlying line editor, which is ex. Some ex commands can be useful to you while you are working in vi, since they can save you a lot of editing time. Most of these commands can be used without ever leaving vi.[18]
You already know how to think of files as a sequence of numbered lines. ex gives you editing commands with greater mobility and scope. With ex, you can move easily between files and transfer text from one file to another in a variety of ways. You can quickly edit blocks of text larger than a single screen. And with global replacement you can make substitutions throughout a file for a given pattern.
This chapter introduces ex and its commands. You will learn how to:
Move around a file by using line numbers
Use ex commands to copy, move, and delete blocks of text
Save files and parts of files
Work with multiple files (reading in text or commands, traveling between files)
[18] vile is different from the other clones in that many of the more advanced ex commands simply don’t work. Instead of noting each command here, we provide more details in Chapter 18.
Get Learning the vi and Vim Editors, 7th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.