docs: add builtin template guide

This commit is contained in:
CoderLambert
2026-05-20 20:24:15 +08:00
parent 734b59f051
commit 9304231b07
+79
View File
@@ -0,0 +1,79 @@
# Builtin Templates
Builtin templates provide the initial project search presets generated by `:ProjectSearchInit` or `:ProjectSearchReset`.
## Metadata
Builtin presets include metadata supported by the rule schema:
```json
{
"id": "react.query_key",
"name": "React: queryKey",
"description": "Search TanStack Query queryKey usage.",
"group": "TanStack",
"tags": ["tanstack", "query", "queryKey"],
"order": 10,
"enabled": true,
"type": "grep",
"search": "queryKey",
"dirs": ["src", "app"],
"glob": ["*.ts", "*.tsx"]
}
```
| Field | Purpose |
| --- | --- |
| `id` | Stable preset identifier. |
| `group` | Picker group header. |
| `tags` | Extra context displayed beside the rule. |
| `order` | Sort order inside a group. |
| `enabled` | Whether the generated rule appears in the picker. |
## Current groups
Common template:
- `Common`
React template:
- `Hooks`
- `React`
- `TanStack`
- `State`
- `UI`
- `Service`
Vue template:
- `Vue`
- `State`
- `Composables`
- `Router`
NestJS template:
- `Nest`
- `DTO`
- `Data`
## Reset behavior
Template metadata only affects newly generated or reset project rules.
Existing project rule files are not changed automatically. To regenerate from templates:
```vim
:ProjectSearchReset
```
or, with the new subcommand interface:
```vim
:ProjectSearch reset
```
## Performance note
Builtin templates are read when rules are initialized or reset. Opening the picker still uses the cached project rules file and does not read builtin templates.