Skip to Content
Practical Vim, 2nd Edition
book

Practical Vim, 2nd Edition

by Drew Neil
October 2015
Intermediate to advanced
356 pages
7h 54m
English
Pragmatic Bookshelf
Content preview from Practical Vim, 2nd Edition
Tip 111Grep with Vim’s Internal Search Engine

The :vimgrep command allows us to search through multiple files using Vim’s native regular expression engine.

As a demonstration, we’ll use the files in the grep/quotes directory, which you can find in the source files that come distributed with this book. The directory contains the following files, reproduced here with their contents:

 quotes/
  about.txt
  Don't watch the clock; do what it does. Keep going.
 
  tough.txt
  When the going gets tough, the tough get going.
 
  where.txt
  If you don't know where you are going,
  you might wind up someplace else.

Each of these files contains at least one occurrence of the word “going.” We can ask Vim to search for that word in each of those files ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning the vi and Vim Editors, 8th Edition

Learning the vi and Vim Editors, 8th Edition

Arnold Robbins, Elbert Hannah
Modern Vim

Modern Vim

Drew Neil
Learning the vi and Vim Editors, 7th Edition

Learning the vi and Vim Editors, 7th Edition

Arnold Robbins, Elbert Hannah, Linda Lamb

Publisher Resources

ISBN: 9781680501629Errata Page