# Find
`deft/stdext/find/` is the project search library (`rg`/`grep` backends)
plus the helpers that open and seed the find panel. It is pure
functions over configuration — the same API backs the find panel, the
editor's project search, scripts, and the AI tools.
from "deft/stdext/find/find" import @{ search default-glob FindResult } from "deft/stdext/find/panel" import @{ open-find-panel seed-find }
## Search API
| Def | Signature | Description |
|---|---|---|
| `search` | `{| query opts |}` | Run a project search; vector of `FindResult` |
| `default-glob` | `{||}` | Effective default glob (`:find/default-glob`, else `*.dft`) |
| `get-cfg` | `{| k default |}` | Read a `:find/<k>` config key |
| `FindResult` (type) | `%{ file line col text }` | One hit; lines and columns are 1-based |
`search` options (all optional):
| Key | Values / default |
|---|---|
| `:pattern` | file glob |
| `:backend` | `:rg` (default) or `:grep` |
| `:root` | search root, default `"."` |
| `:exclude` | directory names to skip |
| `:max-count` | per-file cap (rg only, default 200) |
| `:case` | `:smart` (default), `:sensitive`, `:insensitive` |
| `:follow` | follow symlinks (default from `:find/follow`) |
| `:fixed` | quote the query as a literal string (`-F`) |
Default excludes are `.git`, `zig-out`, `zig-cache`. rg produces true
columns via `--vimgrep`; grep reports column 1. "No matches" (exit 1)
is an empty vector, not an error.
set results [search "my query" %{ :pattern "*.dft" }] set loose [search "my query" %{ :backend :grep :case :insensitive }]
## Panel Helpers
| Def | Signature | Description |
|---|---|---|
| `open-find-panel` | `{||}` | Focus an open find panel, else split and launch one; returns its id (0 on failure) |
| `seed-find` | `{| query pattern |}` | Seed the panel via RPC, retrying for a just-launched instance |
if ([open-find-panel] == 0) {return} [spawn [seed-find $q "*.md"]]
`seed-find` calls the find panel's `set-query-and-search` RPC method; a
nil `pattern` keeps the panel's current glob. The panel itself is the
separate `deft/find` app, documented at
Find app help.
## Configuration
`find/config.dft` registers defaults into the config registry:
%{ :find/backend :rg :find/default-glob "*.dft" :find/follow true }
Override them in `.deft/config.dft`; see
Configuration.
## See Also
- Find app help — the panel UI and RPC method
- App Platform — `@rpc` between panels
- Configuration — the config registry