Synopses & Reviews
There's nothing that hard-core Unix and Linux users are more fanatical about than their text editor. Editors are the subject of adoration and worship, or of scorn and ridicule, depending upon whether the topic of discussion is your editor or someone else's.
vi has been the standard editor for close to 30 years. Popular on Unix and Linux, it has a growing following on Windows systems, too. Most experienced system administrators cite vi as their tool of choice. And since 1986, this book has been the guide for vi.
However, Unix systems are not what they were 30 years ago, and neither is this book. While retaining all the valuable features of previous editions, the 7th edition of Learning the vi and vim Editors has been expanded to include detailed information on vim, the leading vi clone. vim is the default version of vi on most Linux systems and on Mac OS X, and is available for many other operating systems too.
With this guide, you learn text editing basics and advanced tools for both editors, such as multi-window editing, how to write both interactive macros and scripts to extend the editor, and power tools for programmers -- all in the easy-to-follow style that has made this book a classic.
Learning the vi and vim Editors includes:
A complete introduction to text editing with vi:
How to move around vi in a hurryBeyond the basics, such as using buffersvi's global search and replacementAdvanced editing, including customizing vi and executing Unix commandsHow to make full use of vim:Extended text objects and more powerful regular expressionsMulti-window editing and powerful vim scriptsHow to make full use of the GUI version of vim, called gvimvim's enhancements for programmers, such as syntax highlighting, folding and extended tagsCoverage of three other popular
vi clones --
nvi,
elvis, and
vile -- is also included. You'll find several valuable appendixes, including an alphabetical quick reference to both
vi and
ex mode commands for regular
vi and for
vim, plus an updated appendix on
vi and the Internet.
Learning either
vi or
vim is required knowledge if you use Linux or Unix, and in either case, reading this book is essential. After reading this book, the choice of editor will be obvious for you too.
About the Author
Arnold Robbins, an Atlanta native, is a professional programmer and technical author. He has been working with Unix systems since 1980, when he was introduced to a PDP-11 running a version of Sixth Edition Unix. His experience also includes multiple commercial Unix systems, from Sun, IBM, HP and DEC. He has been working with GNU/Linux systems since 1996. He likes his Macintosh laptop, but it has been commandeered by one of his daughters.
Arnold has also been a heavy awk user since 1987, when he became involved with gawk, the GNU project's version of awk. As a member of the POSIX 1003.2 balloting group, he helped shape the POSIX standard for awk. He is currently the maintainer of gawk and its documentation.
O'Reilly has been keeping him busy: He is author and/or coauthor of the bestselling titles: Unix In A Nutshell, Effective awk Programming, sed & awk, Classic Shell Scripting, and several pocket references.
Elbert is a professional software engineer and software architect recently finishing a 21-year career in the telcom industry. He wrote a full screen editor in assembler in 1983 as his first professional assignment, and has had special interest in editors since. He loves connecting Unix to anything and once wrote a stream editor program to automate JCL edits for mainframe monthly configurations by streaming mainframeJCL to a stream editor on an RJE connected Unix box.
He loves tinkering with everything Unix and considers any environment incomplete without his suite of Unix work-alike tools and the latest version of vim. He is a Unix Shell specialist, writing entire applications with only the shell.
His telcom honored him with their highest award for money-saving applications that he authored using a set of mainframe screen-scraping tools he wrote himself. They continue to use those applications today. He was also one of three founding team members that brought web 1.0 to the corporate consciousness in his telco position, and his team featured on the cover of CIO Magazine for their innovative and pioneering works.
He also served a brief stint on the original Microsoft NT beta support team in 1992.
He loves bicycling, music, and reading. Today he lives in the Chicago area where he occasionally takes on short term projects and works on personal software products.
Linda Lamb is a former employee of O'Reilly Media, where she worked in various capacities, including technical writer, editor of technical books, and marketing manager. She also worked on O'Reilly's series of consumer health books, Patient Centered Guides.
Table of Contents
Preface; Scope of This Book; How the Material Is Presented; What You Need to Know Before Starting; Comments and Questions; Safari® Books Online; About the Previous Editions; Preface to the Seventh Edition; Basic and Advanced vi; Chapter 1: The vi Text Editor; 1.1 A Brief Historical Perspective; 1.2 Opening and Closing Files; 1.3 Quitting Without Saving Edits; Chapter 2: Simple Editing; 2.1 vi Commands; 2.2 Moving the Cursor; 2.3 Simple Edits; 2.4 More Ways to Insert Text; 2.5 Joining Two Lines with J; 2.6 Review of Basic vi Commands; Chapter 3: Moving Around in a Hurry; 3.1 Movement by Screens; 3.2 Movement by Text Blocks; 3.3 Movement by Searches; 3.4 Movement by Line Number; 3.5 Review of vi Motion Commands; Chapter 4: Beyond the Basics; 4.1 More Command Combinations; 4.2 Options When Starting vi; 4.3 Making Use of Buffers; 4.4 Marking Your Place; 4.5 Other Advanced Edits; 4.6 Review of vi Buffer and Marking Commands; Chapter 5: Introducing the ex Editor; 5.1 ex Commands; 5.2 Editing with ex; 5.3 Saving and Exiting Files; 5.4 Copying a File into Another File; 5.5 Editing Multiple Files; Chapter 6: Global Replacement; 6.1 Confirming Substitutions; 6.2 Context-Sensitive Replacement; 6.3 Pattern-Matching Rules; 6.4 Pattern-Matching Examples; 6.5 A Final Look at Pattern Matching; Chapter 7: Advanced Editing; 7.1 Customizing vi; 7.2 Executing Unix Commands; 7.3 Saving Commands; 7.4 Using ex Scripts; 7.5 Editing Program Source Code; Chapter 8: Introduction to the vi Clones; 8.1 And These Are My Brothers, Darrell, Darrell, and Darrell; 8.2 Multiwindow Editing; 8.3 GUI Interfaces; 8.4 Extended Regular Expressions; 8.5 Enhanced Tags; 8.6 Improved Facilities; 8.7 Programming Assistance; 8.8 Editor Comparison Summary; 8.9 Nothing Like the Original; 8.10 A Look Ahead; Vim; Chapter 9: Vim (vi Improved): An Introduction; 9.1 Overview; 9.2 Where to Get Vim; 9.3 Getting Vim for Unix and GNU/Linux; 9.4 Getting Vim for Windows Environments; 9.5 Getting Vim for the Macintosh Environment; 9.6 Other Operating Systems; 9.7 Aids and Easy Modes for New Users; 9.8 Summary; Chapter 10: Major Vim Improvements over vi; 10.1 Built-in Help; 10.2 Startup and Initialization Options; 10.3 New Motion Commands; 10.4 Extended Regular Expressions; 10.5 Customizing the Executable; Chapter 11: Multiple Windows in Vim; 11.1 Initiating Multiwindow Editing; 11.2 Opening Windows; 11.3 Moving Around Windows (Getting Your Cursor from Here to There); 11.4 Moving Windows Around; 11.5 Resizing Windows; 11.6 Buffers and Their Interaction with Windows; 11.7 Playing Tag with Windows; 11.8 Tabbed Editing; 11.9 Closing and Quitting Windows; 11.10 Summary; Chapter 12: Vim Scripts; 12.1 What's Your Favorite Color (Scheme)?; 12.2 Dynamic File Type Configuration Through Scripting; 12.3 Some Additional Thoughts About Vim Scripting; 12.4 Resources; Chapter 13: Graphical Vim (gvim); 13.1 General Introduction to gvim; 13.2 Customizing Scrollbars, Menus, and Toolbars; 13.3 gvim in Microsoft Windows; 13.4 gvim in the X Window System; 13.5 GUI Options and Command Synopsis; Chapter 14: Vim Enhancements for Programmers; 14.1 Folding and Outlining (Outline Mode); 14.2 Auto and Smart Indenting; 14.3 Keyword and Dictionary Word Completion; 14.4 Tag Stacking; 14.5 Syntax Highlighting; 14.6 Compiling and Checking Errors with Vim; 14.7 Some Final Thoughts on Vim for Writing Programs; Chapter 15: Other Cool Stuff in Vim; 15.1 Editing Binary Files; 15.2 Digraphs: Non-ASCII Characters; 15.3 Editing Files in Other Places; 15.4 Navigating and Changing Directories; 15.5 Backups with Vim; 15.6 HTML Your Text; 15.7 What's the Difference?; 15.8 Undoing Undos; 15.9 Now, Where Was I?; 15.10 What's My Line (Size)?; 15.11 Abbreviations of Vim Commands and Options; 15.12 A Few Quickies (Not Necessarily Vim-Specific); 15.13 More Resources; Other vi Clones; Chapter 16: nvi: New vi; 16.1 Author and History; 16.2 Important Command-Line Arguments; 16.3 Online Help and Other Documentation; 16.4 Initialization; 16.5 Multiwindow Editing; 16.6 GUI Interfaces; 16.7 Extended Regular Expressions; 16.8 Improvements for Editing; 16.9 Programming Assistance; 16.10 Interesting Features; 16.11 Sources and Supported Operating Systems; Chapter 17: Elvis; 17.1 Author and History; 17.2 Important Command-Line Arguments; 17.3 Online Help and Other Documentation; 17.4 Initialization; 17.5 Multiwindow Editing; 17.6 GUI Interfaces; 17.7 Extended Regular Expressions; 17.8 Improved Editing Facilities; 17.9 Programming Assistance; 17.10 Interesting Features; 17.11 elvis Futures; 17.12 Sources and Supported Operating Systems; Chapter 18: vile: vi Like Emacs; 18.1 Authors and History; 18.2 Important Command-Line Arguments; 18.3 Online Help and Other Documentation; 18.4 Initialization; 18.5 Multiwindow Editing; 18.6 GUI Interfaces; 18.7 Extended Regular Expressions; 18.8 Improved Editing Facilities; 18.9 Programming Assistance; 18.10 Interesting Features; 18.11 Sources and Supported Operating Systems; Appendixes; The vi, ex, and Vim Editors; Command-Line Syntax; Review of vi Operations; vi Commands; vi Configuration; ex Basics; Alphabetical Summary of ex Commands; Setting Options; Solaris vi Options; nvi 1.79 Options; elvis 2.2 Options; Vim 7.1 Options; vile 9.6 Options; Problem Checklists; Problems Opening Files; Problems Saving Files; Problems Getting to Visual Mode; Problems with vi Commands; Problems with Deletions; vi and the Internet; Where to Start; vi Web Sites; A Different vi Clone; Amaze Your Friends!; Tastes Great, Less Filling; vi Quotes; Colophon;