Find and replace text inside the current VS Code file

Command-F opens Find and Option-Command-F opens Replace in the current editor. Verify the file and matching options before replacing text.

Scope
Visual Studio Code · Current vendor documentation checked 3 November 2026; no running-app compatibility test is claimed.
Keyboard and customization
Documented Mac defaults; punctuation and function keys depend on keyboard layout and hardware.. User bindings, app versions, focused controls and installed extensions can change a command. Inspect the active app menu or its shortcut editor when a listed combination differs.
Review basis
Documentation reviewed 2026-11-03 by Codex — primary-documentation and editorial review; no hands-on runtime test. These bindings were not tested in a running app for this guide.

Keep the scope inside the intended editor

This workflow is for one open file. Confirm its path and active tab before entering a query, especially when several similarly named files are open. Workspace-wide replacement is a separate tool with broader consequences and should not be used merely because its search field is easier to find.

Read the matching options

Case sensitivity, whole-word matching and regular expressions can substantially change which text matches. Inspect the selected controls before interpreting a count or replacing a result. Start with an ordinary literal query when diagnosing a mismatch, then enable the more specialised matching behaviour only when the task calls for it.

Replace one result before replacing many

A single replacement is a useful check of both the match and the replacement text. Inspect the changed line and undo if it was wrong. Only broaden the operation after the result is understood; a matching count does not prove that every occurrence has the same meaning or should receive the same edit.

Documented commands for this workflow

Scroll the table sideways to see every column.

ActionKeysWhen to use it
Find in the current fileCommand-FUses the focused editor’s document context. ↗
Open replacement controlsOption-Command-FCheck the replacement text and scope before applying edits. ↗
Select all Find matchesOption-ReturnCreates a broad selection from the current Find match set; inspect it first. ↗

Sources and corrections

Found a mismatch? Email pashaseenainc@gmail.com with your app version, macOS version, keyboard layout and the command. Please leave personal document names out.

Keep going

Right there when you need it.

Keep a compact shortcut reference in your Mac’s menu bar.

Explore the native Mac app