October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 111 | Grep 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 ...
Read now
Unlock full access