You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/configuration/_index.md
+23-6Lines changed: 23 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -365,17 +365,34 @@ Workflow + caveats (sending an iMIP REPLY ≠ importing into your calendar) are
365
365
366
366
## AI handoff (pre-send `i` key)
367
367
368
-
`[ai]` wires any external CLI to the pre-send `i` key. neomd writes the current draft to a temp markdown file (with the same `# [neomd: ...]` headers used during compose), spawns the command with the file path appended as the last argument, and re-reads the file on exit so any edits replace the draft body. Quit the AI tool (`ctrl+c`, `q`, `/quit`, `ZZ`, …) to return to neomd's pre-send screen.
368
+
`[ai]` wires any external CLI to the pre-send `i` key. neomd:
369
+
370
+
1. Shows a one-line prompt for your instruction (e.g. `fix grammar`, `make it more formal`, `tighten this`).
371
+
2. Writes the current draft to a temp markdown file (with the same `# [neomd: ...]` headers used during compose).
372
+
3. Spawns the command with the file path appended as the last arg. Any `{prompt}` token in `args` is replaced by what you typed.
373
+
4. Re-reads the file on exit so the AI's edits replace your draft body.
374
+
375
+
Press Enter on an empty prompt to run interactively (no `{prompt}` substitution); type an instruction + Enter to run non-interactively; press Esc to cancel. Quit the AI tool (`ctrl+c`, `q`, `/quit`, `ZZ`, …) to return to neomd's pre-send screen.
#args = ["--print"] # optional extra args, inserted before the file path
379
+
command = "claude"# default: Claude Code CLI
380
+
args = ["edit {file}: {prompt}"]# default: tells claude what file + what to do
381
+
# command = "codex"
382
+
#command = "aichat"
376
383
```
377
384
378
-
`nvim` is intentionally **not** the default: the compose buffer is already open in nvim before pre-send, so spawning nvim on `i` would just re-edit. Pick a tool that does real work. The handoff reuses the same parser as the regular editor flow, so headers (To, Cc, Bcc, Subject) the AI tool may rewrite are picked up automatically. If `command` is empty the `i` key is a no-op.
385
+
Two placeholders are substituted at spawn time: `{prompt}` becomes your typed instruction, `{file}` becomes the draft's basename. neomd also sets the spawned process's working directory to the temp dir holding the draft, so claude's built-in Edit tool reaches the file natively (no `--add-dir` needed).
386
+
387
+
If you type `fix grammar` at the prompt, the spawn is `claude "edit neomd-ai-XYZ.md: fix grammar"` running in `/tmp/neomd/`. Claude opens interactively, sees the file in cwd, edits in place, you `/quit` when satisfied, neomd picks up the changes.
388
+
389
+
> [!IMPORTANT]
390
+
> Default args use the **interactive** form, not `claude -p`. The `-p` (print) flag in Claude Code is non-interactive and bills against your **API credits** rather than your Claude Pro/Max subscription — it leaks money even when you're paying for a plan. Interactive mode runs under your subscription auth. Only switch to `args = ["-p", "edit {file}: {prompt}"]` if you have an API key with credits and explicitly want the scripted, no-review flow.
391
+
392
+
If you press Enter on an empty prompt, only the `{prompt}` placeholder is replaced (with `""`) — the resulting `"edit neomd-ai-XYZ.md: "` still tells claude which file to look at, so claude opens interactively in the temp dir with that file pre-mentioned and waits for your follow-up instruction.
393
+
394
+
`nvim` is intentionally **not** the default: the compose buffer is already open in nvim before pre-send, so spawning nvim on `i` would just re-edit. You can already use [avante.nvim](https://github.com/yetone/avante.nvim) or others within neovim composer to do any AI you'd like.
395
+
But instead, pick a tool that does work. The handoff reuses the same parser as the regular editor flow, so headers (To, Cc, Bcc, Subject) the AI tool may rewrite are picked up automatically. If `command` is empty the `i` key is a no-op.
b.WriteString(styleHelp.Render(" enter schedule campaign · e edit · p preview · ctrl+f from · d draft · esc cancel · x discard"))
5336
5415
} else {
5337
5416
aiHint:=""
5338
5417
ifstrings.TrimSpace(m.cfg.AI.Command) !="" {
5339
-
aiHint=fmt.Sprintf(" · i AI (%s, quit to return)", strings.Fields(m.cfg.AI.Command)[0])
5418
+
aiHint=" · i AI (quit to return)"
5340
5419
}
5341
-
b.WriteString(styleHelp.Render(" enter send · e edit · s spell · p preview"+aiHint+" · a attach · D remove attach · ctrl+f from · ctrl+b cc/bcc · d draft · esc cancel · x discard"))
5420
+
b.WriteString(styleHelp.Render(" enter send · e edit · s spell · p preview· a attach · D remove attach"+aiHint+" · ctrl+f from · ctrl+b cc/bcc · d draft · esc cancel · x discard"))
0 commit comments