Files

6.2 KiB

Search

Search covers the whole window, edge to edge, like the Git view. One query searches the open file, the contents of the project and the file names at the same time.

Guide index · Related: Go to file, File view, Explorer

At a glance

+----------------------------------------------------------------------------+
| (1) Q  handle_                  (2) [php][md]   (3) 3 here . 39 hits . 2 f |
+----------------------+---------------------------------+-------------------+
| (4) app.php   3      | (5) PROJECT  39                 | (6) FILES  2      |
|  12 function handle  |  src/app.php                 3  |  Handler.php      |
|  40 $this->handle(   |   12  function handle() {       |  src/             |
|  88 handle($r);      |   40  $this->handle($x);        |  handle.md  *     |
|                      |  tests/AppTest.php           1  |  docs/            |
|                      |    7  ->handle()                |                   |
+----------------------+---------------------------------+-------------------+
| (7) Cmd+Left / Cmd+Right column   Cmd+Up / Cmd+Down row   Enter open   esc |
+----------------------------------------------------------------------------+
  1. Query field: type here. The field has the keyboard as soon as Search opens.
  2. Type chips: one chip per file type in the results. Click one to show only that type.
  3. Summary: hits in this file, hits in the project, and matching file names.
  4. This file: matches in the open file. Only shown when a file is open.
  5. Project: content matches in the whole project, grouped per file.
  6. Files: file names that match the query.
  7. Footer: the keys, and an esc chip.

Features

  • Press Cmd+F, or click Search in the title bar.
  • With text selected in the file view, the query starts with the first line of that selection.
  • Search covers the whole window, title bar and status bar included, with no margin. Press Esc to close it.
  • Over the Git or Schema view, Search opens on top of it. From the Diff, Search takes its place.
  • Cmd+G and Cmd+D close Search and open the Git or Schema view (or leave it open, if it was under Search). Every other key stays with Search.

Typing

  • Results update as you type.
  • This file and Files search from the first character.
  • Project searches from two characters, after a very short pause. Each new key cancels the older search.
  • Leading and trailing spaces are ignored.
  • This file ignores case.
  • Project ignores case, unless the query holds a capital letter. Then it matches case exactly.
  • Files is fuzzy: the letters must appear in order, not next to each other. hdlr finds Handler.php. Matched letters are amber.
  • File names that match on the name come first, before matches that only hit the folder path. Earlier and shorter matches rank higher.

The three columns

  • The columns keep a fixed width: This file 30 percent, Project 45 percent, Files 25 percent. Without an open file: Project 65 percent, Files 35 percent.
  • Moving the focus does not change a width. The focused column's title and count turn amber.
  • Each project file shows its path and its number of hits. Up to 12 hit lines are shown per file; the count still tells the full number.
  • Each hit line shows its line number and the line, with the match highlighted.
  • In Files, the folder sits below the name. An amber dot marks a file with uncommitted git changes.

Type chips

  • Chips appear when the results hold more than one file type. The most common type comes first.
  • Click a chip to show only that type in Project and Files. Click it again to show every type.
  • Hover a chip to see how many results it has.

Opening a result

  • Press Enter or click a row. Search closes and the file opens in the file view.
  • A content hit opens the file at that line.
  • Click a file header in Project to open the file at its first hit.
  • A file name opens the file at the top.
  • When the focused column is empty, Enter opens the first result of the other kind.

Mouse and keyboard

  • Moving the pointer over a row selects it and focuses its column.
  • When you move with the keyboard, a pointer that does not move does not steal the selection.

What is searched

  • The whole project, including dotfiles such as .env.
  • Hidden files and folders (those starting with a dot) only show when Hidden (Cmd+.) is on. See Layout.
  • Some folders are always skipped: node_modules, .git, vendor, dist, build, out, coverage, .cache, .next, .nuxt, .turbo, .idea, .vscode and .helder.
  • Add your own skips with files.exclude.
  • Git-ignored files are searched too, unless you set files.followGitignore to true.

No results

Each column says why it is empty:

  • "Type to search this file." / "No matches in this file."
  • "Type at least two characters." / "No content matches."
  • "Type to search file names." / "No file names match."

Limits

  • Project: at most 400 files and 50 hits per file. Very long lines are cut.
  • Files: the first 40 matches are listed. The count shows the full number.
  • This file: at most 200 hits.
  • Up to 12 type chips.

Keyboard

Keys Action
Cmd+F Open Search
Cmd+Left / Cmd+Right Previous / next column
Up / Down Previous / next row in the column
Cmd+Up / Cmd+Down Previous / next row in the column
Enter Open the selected result
Cmd+G / Cmd+D Close Search and open the Git / Schema view
Esc Close Search

Settings

Setting Default Effect
files.exclude [] Extra globs to leave out of search and the Explorer.
files.followGitignore false true leaves git-ignored files out.

See Configuration.