Learning the vi and Vim Editors

Learning the vi and Vim Editors

Arnold Robbins, Elbert Hannah

Language: English

Pages: 494

ISBN: 059652983X

Format: PDF / Kindle (mobi) / ePub


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 hurry
  • Beyond the basics, such as using buffers
  • vi's global search and replacement
  • Advanced editing, including customizing vi and executing Unix commands
  • How to make full use of vim:

  • Extended text objects and more powerful regular expressions
  • Multi-window editing and powerful vim scripts
  • How to make full use of the GUI version of vim, called gvim
  • vim's enhancements for programmers, such as syntax highlighting, folding and extended tags
  • Coverage 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.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    from vi read-only mode, Read-Only Mode at specific place, Advancing to a Specific Place problems opening, Problems Opening Files quitting, Saving and Quitting a File (see quitting vi) reading as vi environments, Alternate Environments renaming buffer (ex), Renaming the Buffer saving, Saving and Quitting a File, Problems Saving Files (see saving edits) writing, Read-Only Mode (see writing the buffer) :files command, Buffers and Their Interaction with Windows, Buffer Command Synopsis

    repeatedly but you don’t want to use a global substitution. If you think of the & as meaning “the same thing” (as in, what was just matched), this command is relatively mnemonic. You can follow the & with a g, to make the substitution globally on the line, and even use it with a line range: :%&gRepeat the last substitution everywhere The & key can be used as a vi command to perform the :& command, i.e., to repeat the last substitution. This can save even more typing than :s ENTER—one

    substitute Vim for vi. On many systems you’ll find old versions of Vim. This section may therefore be useful to help you install the latest version, even if you have Vim already. Once you are in the editor, check not only that you are running Vim but also the version with the :version command. Vim will provide a screen resembling this: :version VIM - Vi IMproved 7.0 (2006 May 7, compiled Aug 30 2006 21:54:03) Included patches: 1-76 Compiled by corinna@cathi Huge version without GUI. Features

    of downloading via command line may seem a bit foreign to newer users. Once files are downloaded, the procedure for installation is very similar to the Unix compilation and installation procedure described earlier in the section Getting Vim for Unix and GNU/Linux. Other Operating Systems Vim’s home page lists more environments for which Vim ostensibly works, but it offers the caveat to use them at your own risk. These other Vims are for: QNX, a real-time operating system (RTOS)

    or by using the o (open new line) command. O This context covers the creation of a new line above the current line using the O (open new line above) command. e This is the else context. If you begin a line with the word else, Vim reevaluates indentation. Vim does not recognize this context until the final “e” of else is typed. cinkeys syntax rules. Each cinkeys definition consists of an optional prefix (one of !, *, or 0) and the key for which indentation is reevaluated. The prefixes

    Download sample

    Download