Sie sind auf Seite 1von 99
C P UNIX Text Processing ‘ O'Reilly & Associates, Inc. Learning the vi Editor For many users, working in the UNIX environment means using vi, a full-screen text editor available on most UNIX systems, Even those who know vf often make use of only a small number of its features. rT This handbook is a complete guide to text editing with vi Quickly learn the basics of editing, cursor movement, and global search and replacement, Then take advantage of the more subtle, frequently overlooked powers of vi. Extend your editing skills by learning to use ex, a powerful line editor, from within vi i Topics covered include: * Basic editing + Moving around in a hurry ‘+ Beyond the basics ALONPT * Greater power with ex * Global search & replacement * Customizing vi and ex * Command shortcuts * Quick reference to vi and ex commands [As one user told us, “This book is the only reason I know for using v7 instead of emacs.” 180" 0-937175-67-6 | | | il 780937"175675 Bylinda Lamb 2 OReilly & Associates, Inc. | Learning the vi Editor Linda Lamb O'Reilly & Associates, Inc. 103 Morris Street, Suite A Sebastopol, CA 95472 ‘Learning the vi Eattor by Linda Lamb Copyright © 1986 1987, 1988, 1990 O'Reily & Asecates, Ie. Allright reserved Printed inthe United Stats of Americ. Editor: Tim O'Reilly Printing History: February 1986: Firs edition, by Linda Lamb, April 1986: Second edition, with minor corrections. ‘August 1987; Third edition; revised and enlarged, index added, bby Walter Gellant. Revised page design by Linda Lamb and Dale Dougherty. one 1988: Fourth edition; updated, minor corrections by Tim OReilly. October 1990: Fifth edition; evised and enlarged by Daniel Gilly. May 1992: Minor coretions. ‘Angust 1994: Minor corections. "Nutshell Handbook andthe Nutshell Handbook logo are registered trademarks ‘of O'Reilly & Associates, In. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly and Associates Inc. was aware ofa trademark claim, the designations have been printed in caps or initial caps. ‘While every precaution has been taken in te preparation ofthis book, the {publisher assumes no responsibility for eros or omissions, or for damages resulting from the use of the information contained herein, & ‘This book is printed on acid-free paper with 50% recycled content, 10-15% post-consumer waste. O'Reilly & Associates is committed o using paper with the highest recycled content available consistent with high quality ISBN: 0.937175-67-6 ratio omtents sa Table of Contents Preface to the Sth Edition .. ‘Scope of This Handbook ‘The Nutshell Format snr Discussion of vi Commands . ‘Typefaces Keystrokes .. Problem Checklist. ‘What You Need to Know Before Starting Chapter 1 The vi Text Bdt08 ssn Opening and Closing Files wamnsnsnns ‘Opening a File Problems Opening Files Saving and Quitting a File Quitting Without Saving Edits. Problems Saving Files Chapter 2. Simple Biting nn vi Commands Moving the Cursor ‘Single Movements wns ‘Numeric Arguments Movement Within a Line. Movement by Text Blocks ‘Simple Edits Inserting New Text Appending Text... (Changing Text...

Das könnte Ihnen auch gefallen