Find and replace in Visual Studio code

I was able to get it to work but the workflow is poor:

  1. control + H to open Find/Replace
  2. Select your line of text
  3. Click the "Find in selection" icon to the right Alt L or L on macOS)
  4. Enter your find and replace characters in their inputs
  5. Click the Replace all icon

It works but you have to go through the workflow all over again for each new selection (except for CTR + H of course). BTW I have the exact same behavior in Sublime Text.

Could you go with a regExp to find your lines? Do they contain only .'s and 1's?


From the VSCode devs:

We used to enable find in selection automatically when opening the find widget with a selection, but it was too easy to trigger accidentally and produced a lot of complaints. You probably want to set "editor.find.autoFindInSelection": true which will make it work the way you expect.

The VSCode GitHub issue has more details if anyone is interested.

EDIT: The autoFindInSelection option is available starting from VSCode 1.13. That version is currently in development (as of 6/7/2017), so this fix won't work until the new version is released.


This is a more general answer for other users who come here just wanting to use basic find and replace functionality.

On Mac you can press Command + Option + F to open Find and Replace:

enter image description here

Alternatively, you can press Command + F to open Find and then click the little triangle on the left to show the Replace field:

enter image description here