Sherlock Search
Sherlock Search is Find in Files for VS Code, the way JetBrains IDEs do it. You type, and a dense
list of matching lines fills in as you go. The arrow keys move through it, and each match shows in
a syntax-highlighted preview beside the list. Nothing opens in your editor until you press
Enter, and Esc puts you back exactly where you were.

Features
Search
- Search as you type, over the whole workspace, with ripgrep. Results stream in while the search
runs, and a new keystroke replaces the search before it at once.
- Match case, whole word and regular expression switches, as in VS Code's find box.
- Files to include and files to exclude, as comma-separated globs:
src, *.ts.
- The search covers what VS Code's own does:
files.exclude, search.exclude, .gitignore and
the other ignore-file settings apply, for each workspace folder.
- Selected text in the editor becomes the query. Earlier queries are a keystroke away, and the
search reopens with the query and the results you left it with.
Results
- One line per match, with the match marked and the file and line number at the right. Thousands
of results scroll smoothly.
- Matches in the files you used last come first, most recent file first, with a hairline before
everything else. One key switches between that and the plain order.
- The file name is what stands out in a row. When a row is short of room, the text of the line is
cut first, then the folders by whole names; the file name and the line number stay.
Preview
- The file around the selected match, coloured with VS Code's own TextMate engine and your theme's
colours, with every match highlighted.
- Stepping through the results is instant: the files of the next results are read ahead.
- The preview sits to the right of the results or below them, and the divider between the two can
be dragged.
Out of your way
- Focus stays in the search box. The arrow keys, Page Up and Page Down move
through the results while you keep typing.
- Looking through results opens no tabs and leaves nothing in the navigation history. Closing the
search gives back the editor, the selection and the tabs as they were.
- Enter opens a match where you were, Ctrl+Enter opens it to the
side, and Alt+Enter opens it in a tab behind the search, which stays up
for the next one.
Everywhere
- Remote SSH, WSL and Dev Containers: the search runs next to the files, and only the rows you
look at travel to your machine.
- Sherlock follows the VS Code theme, high contrast included, and uses the editor's font.

Getting started
Sherlock needs VS Code 1.100 or later. It uses the ripgrep that ships with VS Code.
Open it with Ctrl+Alt+F
(Cmd+Alt+Shift+F on macOS) or run
Sherlock: Find in Files from the Command Palette. To have it take the place of VS Code's
Search view on Ctrl+Shift+F, switch on
sherlock.replaceFindInFiles.
Keyboard
| Keys |
What they do |
| ↑ ↓ Page Up Page Down |
Move through the results |
| Ctrl+Home, Ctrl+End |
The first result, the last result |
| Enter |
Open the match where you were, close the search |
| Ctrl+Enter |
Open the match to the side, close the search |
| Alt+Enter |
Open the match behind the search, which stays |
| Alt+C, Alt+W, Alt+R |
Match case, whole word, regular expression |
| Alt+O |
Recent files first, or the plain order |
| Alt+↑, Alt+↓ |
Earlier and later queries |
| Tab |
Search box, switches, results, preview |
| Esc |
Close the search |
On macOS the switches are ⌥⌘ with the same letters, and Cmd
stands in for Ctrl. A click selects a result and a double click opens it. The switches
are remembered for each workspace.
Settings
| Setting |
Default |
What it does |
sherlock.replaceFindInFiles |
off |
Ctrl+Shift+F opens Sherlock, not the Search view. |
sherlock.preview.position |
auto |
The preview to the right, at the bottom, or wherever there is room. |
sherlock.results.pathFormat |
relative |
A row names its file by its relative path, or by its name alone. |
sherlock.results.rowHeight |
22 |
Height of a result row, in pixels. |
sherlock.font.family |
the editor's |
Font of the results and the preview. |
sherlock.font.size |
the editor's |
Font size of the results and the preview. |
sherlock.closeOnOpen |
on |
Enter closes the search when it opens a match. |
sherlock.seedFromSelection |
on |
Start with the editor's selection as the query. |
sherlock.search.maxResults |
10,000 |
Matching lines a search collects before it stops. |
sherlock.search.debounce |
50 ms |
The pause after a keystroke before searching (120 ms in remote windows). |
sherlock.ripgrepPath |
none |
The rg executable. By default, the one VS Code ships, then PATH. |
Good to know
- Sherlock opens as a tab over the editor group you are in, and closes without a trace.
- ripgrep reads files from disk, so a file with unsaved changes is searched, and previewed, as it
was last saved.
- Regular expressions are ripgrep's: Rust syntax, with look-around and backreferences.
- In a remote window the preview takes its colours from the grammars and the default themes that
ship with Sherlock.
License
MIT
| |