Chapter 14: Substitution

Chapter Overview

Part IV: Patterns | Tips 87-95

The substitute command is Vim’s search and replace.

Tips in This Chapter

Tip Title Mastered

87

Meet the Substitute Command

[ ]

88

Find and Replace Every Match in a File

[ ]

89

Eyeball Each Substitution

[ ]

90

Reuse the Last Search Pattern

[ ]

91

Replace with the Contents of a Register

[ ]

92

Repeat the Previous Substitute Command

[ ]

93

Rearrange CSV Fields Using Submatches

[ ]

94

Perform Arithmetic on the Replacement

[ ]

95

Swap Two or More Words

[ ]

Substitute Flags

Flag Effect

g

Global (all on line)

c

Confirm each

n

Count matches only

e

Suppress errors

&

Reuse flags

Commands Learned

Command Description Notes

Practice

Commands I tried while reading:

" (Add commands you practiced)

Questions

Things I want to explore further.

Chapter Complete

  • Read entire chapter

  • Tried all tips

  • Noted key learnings

Date completed: _