Global Commands

Execute commands on lines matching a pattern

Open companion guide

Goals

0/2
  • Use :g/pattern/command
  • Delete matching lines with :g/pattern/d
Keys 0 · par 20

Instructions

  1. 1.Delete all lines containing "DEBUG"
  2. 2.Use :g/DEBUG/d to remove debug lines
Quick KeysNORMAL
h j k lMove cursor
w b eWord movement
i a oEnter insert
dDelete
yYank (copy)
pPaste
uUndo
vVisual mode
:Command mode
/Search

Community pulse

Weekly top score
Leaderboard warming up...
Daily challenge
Loading challenge...
Vim mode: normal

Practice buffer · reset restarts the lesson (not vim u)

Lesson Companion

Use Global Commands in real editing

This companion guide helps you complete Global Commands with fewer mistakes and better command fluency.

Quick Command Cheatsheet
  • global
  • :g
When to Use This Motion/Operator

Use this lesson whenever you need to scan code quickly for repeated symbols or terms with fewer keystrokes.

  • Prefer this over arrow-key micro-movements before each edit.
  • Use this pattern whenever you're working inside Search & Replace tasks.
  • Reach for global, :g when this pattern appears.
Common Mistakes
  • Searching without using n/N to step between matches.
  • Forgetting * and # to search the word under the cursor.
FAQ

How long should this lesson take?

Target completion is 60 seconds, but correctness matters more than speed at first.

Should I move to the next lesson if my score is low?

Advanced patterns take longer to feel natural, so a lower score on the first pass is normal — prioritize accuracy over speed here.