65
Editing Multiple Files
65
6.
Global Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Confirming Substitutions
72
Context-Sensitive Replacement
73
Pattern-Matching Rules
74
Pattern-Matching Examples
81
A Final Look at Pattern Matching
89
7.
Advanced Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Customizing vi
95
Executing Unix Commands
99
Saving Commands
103
Using ex Scripts
114
Editing Program Source Code
120
8.
Introduction to the vi Clones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
And These Are My Brothers, Darrell, Darrell, and Darrell
125
Multiwindow Editing
126
GUI Interfaces
127
Extended Regular Expressions
128
Enhanced Tags
129
Improved Facilities
134
Programming Assistance
138
Editor Comparison Summary
140
Nothing Like the Original
141
A Look Ahead
141
Part II. Vim
9.
Vim (vi Improved): An Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Overview
146
Where to Get Vim
150
Getting Vim for Unix and GNU/Linux
151
Getting Vim for Windows Environments
156
Getting Vim for the Macintosh Environment
157
Other Operating Systems
157
viii | Table of Contents
Aids and Easy Modes for New Users
157
Summary
158
10. Major Vim Improvements over vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Built-in Help
159
Startup and Initialization Options
160
New Motion Commands
167
Extended Regular Expressions
169
Customizing the Executable
171
11. Multiple Windows in Vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Initiating Multiwindow Editing
174
Opening Windows
177
Moving Around Windows (Getting Your Cursor from Here to There)
180
Moving Windows Around
181
Resizing Windows
183
Buffers and Their Interaction with
Windows
186
Playing Tag with Windows
190
Tabbed Editing
191
Closing and Quitting Windows
192
Summary
193
12. Vim Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Whats Your Favorite Color (Scheme)?
195
Dynamic File Type Configuration Through Scripting
205
Some Additional Thoughts About Vim Scripting
213
Resources
218
13. Graphical Vim (gvim) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
General Introduction to gvim
220
Customizing Scrollbars, Menus, and Toolbars
225
gvim in Microsoft Windows
236
gvim in the X Window System
237
GUI Options and Command Synopsis
237
14. Vim Enhancements for Programmers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Folding and Outlining (Outline Mode)
240
Auto and Smart Indenting
251
Keyword and Dictionary Word Completion
259
Tag Stacking
268
Syntax Highlighting
270
Compiling and Checking Errors with Vim
279
Some Final Thoughts on Vim for Writing Programs
284
Table of Contents | ix
15. Other Cool Stuff in Vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Editing Binary Files
285
Digraphs: Non-ASCII Characters
287
Editing Files in Other Places
289
Navigating and Changing Directories
290
Backups with Vim
292
HTML Your Text
293
Whats the Difference?
294
Undoing Undos
296
Now, Where Was I?
297
Whats My Line (Size)?
300
Abbreviations of Vim Commands and Options
302
A Few Quickies (Not Necessarily Vim-Specific)
303
More Resources
304
Part III. Other vi Clones
16. nvi: New vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Author and History
307
Important Command-Line Arguments
308
Online Help and Other Documentation
309
Initialization
309
Multiwindow Editing
310
GUI Interfaces
311
Extended Regular Expressions
311
Improvements for Editing
312
Programming Assistance
315
Interesting Features
315
Sources and Supported Operating Systems
315
17. Elvis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Author and History
317
Important Command-Line Arguments
317
Online Help and Other Documentation
319
Initialization
319
Multiwindow Editing
320
GUI Interfaces
323
Extended Regular Expressions
328
Improved Editing Facilities
328
Programming Assistance
332
Interesting Features
335
elvis Futures
340
x | Table of Contents
Sources and Supported Operating Systems
340
18. vile: vi Like Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Authors and History
343
Important Command-Line Arguments
344
Online Help and Other Documentation
345
Initialization
346
Multiwindow Editing