visual-studio-code

VSCode: How to perform "Clear Search Results" in "Find in Files" without using the mouse?


After I search through files in the project directory with Command-Shift-f, the files that are opened are have the search string highlighted. The only way to unhighlight them seems to be to clear the search results. But typing "Esc" doesn't do that. I have to click the top-right corner "Clear Search Results" button. Is there a keyboard shortcut for that?


Solution

  • Update:

    Now you can add keybindings for these commands. Example:

    {
        "key": "cmd+escape",
        "command": "search.action.clearSearchResults",
        "when": "editorTextFocus"
    }
    

    The best way to find these commands is by searching in the Keybindings editor. The others are search.action.refreshSearchResults and search.action.collapseSearchResults.


    Original answer:

    Not yet, but there is an open feature request to allow it: https://github.com/Microsoft/vscode/issues/23558