9

Is there any way to navigate the search editor (whole workspace search) using only cursor keys in vscode ? I'm talking about the whole workspace search and not just the find/replace search.This is the editor I'm talking about

soulshined
10.8k5 gold badges52 silver badges85 bronze badges
asked Jul 26, 2020 at 21:59
4
  • Can you include a picture or some sort of visual descriptor because vscode has multiple search ‘editors’. Either way you should be above to navigate tabbing through the elements, or forcing tab trapping mode code.visualstudio.com/docs/editor/accessibility#_tab-navigation Commented Jul 26, 2020 at 22:30
  • included an image. Commented Jul 26, 2020 at 22:43
  • Please mark my answer accepted if it helped pandith, otherwise let me know where I can improve Commented Jul 28, 2020 at 16:22
  • For reference: Search Editor docs (snap shots) and release notes of v1.43 from February 2020. Commented Mar 10, 2023 at 11:18

1 Answer 1

12

The new search editor thankfully has ported over most of the shortcut commands you have grown to know, but for brevity, this answer will include only the default keybinds with respective command id.

The when expression most commonly associated with these keybinds, should you want to alter them, are :

inSearchEditor

hasSearchResult

searchInputBoxFocus

Searching

Context Lines

  • Toggle context lines : toggleSearchEditorContextLines ALT + L

    Will show n lines before or after search result, for context

  • Reduce context line quantity : decreaseSearchEditorContextLines ALT + -
  • Increase context line quantity : increaseSearchEditorContextLines ALT + =

Query Details

  • Toggle Query Details : workbench.action.search.toggleQueryDetails

    This will toggle the include/exclude file input boxes

Settings

  • Toggle Match Case : toggleSearchCaseSensitive ALT + C
  • Toggle Regex : toggleSearchEditorRegex ALT + R
  • Toggle Word Match : toggleSearchEditorWholeWord ALT + W

Navigation

Luckily, because the search editor is effectively an 'editor', you can continue to use all the keybinds that you are used to. So, in order to jump straight to the editor, you can use whatever your keybind is to jump to an editor group, default is: CTRL + 1 (commandId: workbench.action.focusFirstEditorGroup)

Navigating matches

  • Go to next match : search.action.focusNextSearchResult F4
  • Go to previous match : search.action.focusPreviousSearchResult SHIFT + F4
  • Select all matches : selectAllSearchEditorMatches CTRL + SHIFT + L

Results

  • Deleting result block : workbench.action.searchEditor.deleteResultBlock CTRL + SHIFT + BACKSPACE

    This deletes a block of results from the editor

    For example, in the picture below, if my cursor is anywhere in the 'convert.js' result block the entire convert.js matches would be removed. You can undo this with CTRL + Z

  • Go To Definition (effectively go to file)

    • You can peek with ALT + F12 when your cursor is anywhere on the file name
    • You can assign a keyboard shortcut to follow links for the commandId: editor.action.openLink for when your cursor is on the file name
    • You can go directly to the file & line number of the search result using F12 while your cursor is anywhere on that result

Navigate Back to Input Box

  • Focus Search Input Box From Results: search.action.focusQueryEditorWidget ESCAPE

Searching within Search Editor

As noted, the search editor is effectively an editor, so you can resume using CTRL + F (find) or CTRL + H (find/replace) to narrow down results even more, and the keybinds set for those are maintained as used elsewhere.

search editor

Miscellaneous

  • Search again: rerunSearchEditorSearch CTRL + SHIFT + R

    Perhaps you deleted too many result blocks

Otherwise, while your cursor is actively in the editor (results), you have the freedom to use most of your keybinds per normal, including collapsing/folding, jumping, copying, moving to editor groups etc

answered Jul 27, 2020 at 0:51
Sign up to request clarification or add additional context in comments.

1 Comment

With VSCode 1.51: github.com/microsoft/vscode/issues/107208, one more shortcut.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.