Skip to Content
Mastering Vim
book

Mastering Vim

by Ruslan Osipov
November 2018
Beginner
330 pages
7h 21m
English
Packt Publishing
Content preview from Mastering Vim

Operations across files using arglist

Arglist allows you to perform the same operation on multiple files, without having to have them preloaded in buffers first.

Arglist provides a few commands, as follows:

  • :arg defines the arglist.
  • :argdo allows you to execute a command on all the files in the arglist.
  • :args displays the list of files in the arglist.

For example, if we wanted to replace all instances of animal in every Python file (recursively), we would do the following:

:arg **/*.py:argdo %s/\<animal\>/creature/ge | update

This command work as follows:

  • :arg <pattern> adds a set of files matching a pattern to the arglist (each argument in arglist also has a corresponding buffer).
  • **/*.py is a wildcard for every .py file, recursively ...
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

Mastering Vim

Mastering Vim

Damian Conway
Vim Masterclass

Vim Masterclass

Jason Cannon
Modern Vim

Modern Vim

Drew Neil

Publisher Resources

ISBN: 9781789341096Supplemental Content