Why Vim :g//d Freezes on Large Files — Root Cause and Fixes
Why Vim :g//d · :v//d Freezes on Large Files Text Editors · Performance Analysis · Vim/Neovim Comparison You open a multi-hundred-thousand-line log or generated text file in Vim, run :g/pattern/d to strip out unwanted lines, and watch a high-spec machine grind to a halt. The command looks deceptively simple — one line in the Ex buffer. The freeze, however, is real and reproducible. The actual culprit is tens or hundreds of thousands of hidden side-effect operations silently piggybacking on each individual deletion. The fix is not switching editors; it is changing how the operation is structured. This article walks through the root cause, ranked workarounds, and an honest Vim vs. Neovim comparison. 🧩 TL;DR — The freeze comes from d firing individually for every matched line, touching the clipboard, numbered registers, and undo history on each hit. The quickest fix is the blackhole register ; the definitive fix for millions of lines is an external stream filter ( grep , r...