Search code examples
visual-studio-codereplacevscode-debugger

Find And Replace + SKIP in VS Code


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.


Solution

  • 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"
      }