Dev Tools · 1h ago
Comment Out Entire Files in Vim Without Plugins
Two built-in Vim methods let developers comment out entire files in seconds using visual mode or command-line ranges. The visual method selects all lines with 'ggVG' then applies comment toggling. The command method uses ':%s/^/# /' to prepend comment characters.
Meridian48 take
Useful productivity tip for Vim users, but the headline overstates novelty—these are basic editor features, not new discoveries.
Read the full reporting
Whether you're debugging, testing a new implementation, or temporarily disabling code, there are times when you need to comment out an entire file in Vim. While many developers rely on plugins, Vim already provides powerful built-in commands that make this incredibly fast. →
DEV Community
vimdeveloper-tools