Chapter 15: Global Commands

Chapter Overview

Part IV: Patterns | Tips 96-101

The global command executes Ex commands on matching lines.

Tips in This Chapter

Tip Title Mastered

96

Meet the Global Command

[ ]

97

Delete Lines Containing a Pattern

[ ]

98

Collect TODO Items in a Register

[ ]

99

Alphabetize the Properties of Each Rule in a CSS File

[ ]

Global Command Syntax

:[range]g/{pattern}/[cmd]

Common Patterns

Command Effect

:g/pattern/d

Delete matching lines

:v/pattern/d

Delete non-matching lines

:g/pattern/y A

Yank to register a

:g/pattern/normal @q

Run macro on matches

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: _