Find And Replace + SKIP in VS Code

Viewed 515

Is there a way to do find and replace in VS Code where you can skip over certain words as you press ENTER ENTER ENTER over and over down a page of code or text?

I find it extremely annoying to have to grab the mouse, click the down arrow to skip the erroneous match, then click again in the replace box to resume after the skip.

Looking for some keypress or hotkey which I can use in that moment to skip so I can completely avoid touching the mouse entirely.

2 Answers

The action of Enter depends on which textbox has the focus.

  • find textbox : search next occurrence
  • replace textbox : replace current and search next occurrence

You can use Tab and Shift+Tab to switch focus.

Or you can add a keybinding for the editor.action.nextMatchFindAction that is only active when the focus is in the replace textbox.

  {
    "key": "ctrl+shift+enter",
    "command": "editor.action.nextMatchFindAction",
    "when": "editorFocus && replaceInputFocussed"
  }

F3 (Shift-F3 for backward) exactly does it. Default keybinding binds it to Find Next (or Find Previous), and is available even when the find or replace text box is focused.

Related