Tip 70 | Act Upon a Collection of Files |
So far, we’ve stuck to tasks that were repeated in the same file, but we can play back a macro across a collection of files. Once again, we’ll consider how to execute the macro in parallel and in series.
Let’s start with a set of files that look something like this:
| # ...[end of copyright notice] |
| class Animal |
| # implementation |
| end |
We’ll wrap the class in a module to end up with this:
| # ...[end of copyright notice] |
| module Rank |
| class Animal |
| # implementation... |
| end |
| end |
Preparation
Source these lines of configuration to reproduce the examples in this tip:
| set nocompatible |
| filetype plugin indent on |
| set hidden |
| if has( ... |
Get Practical Vim, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.