Learning the vi and Vim Editors
Arnold Robbins, Elbert Hannah
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 make full use of vim:
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.
named ~/.vim/after/syntax. In our xml.vim file we put the line: highlight identifier ctermfg=red guifg=red Before this customization works, we must ensure that ~/.vim/after/syntax is in the runtimepath path: :set runtimepath+=~/.vim/after/syntaxIn our .vimrc To make the change permanent, of course, the line should go in our .vimrc file. Now, whenever Vim loads syntax definitions for xml, it will override the definitions for identifier with our own customization. Rolling Your Own
shown here: Screen editorsare very popular, since they allow you to make changes as you read through a file. you can delete the first two lines: Keystrokes Results 2dd changes as you read through a file. Give the command to delete two lines (2dd). Note that even though the cursor was not positioned on the beginning of the line, the entire line is deleted. The D command deletes from the cursor position to the end of the line. (D is a shortcut for d$.) For example, with the cursor
slash parameter (sessionoptions option), The mksession Command :slast (:sl) command (elvis), Multiwindow Editing smart indenting, Auto and Smart Indenting, Keyword and Dictionary Word Completion smartindent method, Auto and Smart Indenting sn command, :snew (:sne) command (elvis), Multiwindow Editing :sNext (:sN) command (elvis), Multiwindow Editing, Multiwindow Editing :so command (ex), Alternate Environments Solaris vi, Word Abbreviation, Using Tags, Solaris vi, Exuberant ctags and Vim,
selected text by selecting the text object around the cursor. For example, the cursor can be within a “word,” and at the same time be within a “sentence,” and also be within a “paragraph.” Vim lets you add to the visual selection with commands that extend the highlighted region to a text object. To visually select a word, you can use aw (when in visual mode). Vim uses the following motion commands by taking advantage of “visual mode,” which highlights lines and characters in the buffer in order
for readability from the original. Instead of ks, we used the equivalent but more obvious command mark s. This simply creates a marked position named s in the file so we can return to this point later. | Pipe characters separate multiple Vim commands that are executed within an autocommand definition. These are simple separators with no relationship to Unix shell pipes. call LastMod() This calls our user-defined LastMod function. | Same as previous. 's Return to the line we marked