Prerequisites
Is your feature request related to a problem? Please describe.
require("opencode").ask() can open an input and send its result to
OpenCode, but it cannot read the prompt text already being composed in
the active OpenCode TUI.
For example:
- Start writing a prompt in the OpenCode TUI.
- Switch to Neovim.
- Call
require("opencode").ask().
- Ask opens without the existing TUI draft.
I would like to edit that same draft from Neovim and return the modified
text to the active TUI.
The intended workflow is similar to OpenCode's /editor command:
- Start composing in the TUI.
- Open the current draft in Neovim.
- Edit it using the existing Neovim instance.
- Return the edited draft to the same TUI.
- Continue editing or submit it from there.
This must stay in the current OpenCode session/conversation. It should
not create a new session, fork the conversation, or send the existing
draft as a separate message.
This is distinct from #185. The main request is reading and replacing
the active TUI draft, rather than generally replacing Ask with a
multiline input widget.
Describe the solution you'd like
Expose an opt-in "edit current TUI prompt" flow through ask(). The exact
public API is less important than the following behavior:
- Read the current prompt from the connected OpenCode TUI.
- Use that text as the initial value shown by Ask.
- Let the user edit it in Neovim.
- On confirmation, replace the TUI prompt with the edited value instead
of appending to the old value.
- Leave the prompt unsubmitted by default, matching
/editor.
- Keep the same active TUI and session.
- On cancellation, leave the original TUI prompt unchanged.
- If the edited value is empty, clear the TUI prompt.
- Round-trip the complete prompt text, including newlines.
Existing behavior for explicit calls such as:
require("opencode").ask("@this: ")
### Describe alternatives you've considered
Using the EDITOR command from the TUI, but since I open the TUI from `nvim +terminal` , it's harder to use the same NVIM editor as EDITOR and keeping the conversation visible while a hover editor is on top of the TUI prompt
### Additional context
_No response_
Prerequisites
Is your feature request related to a problem? Please describe.
require("opencode").ask()can open an input and send its result toOpenCode, but it cannot read the prompt text already being composed in
the active OpenCode TUI.
For example:
require("opencode").ask().I would like to edit that same draft from Neovim and return the modified
text to the active TUI.
The intended workflow is similar to OpenCode's
/editorcommand:This must stay in the current OpenCode session/conversation. It should
not create a new session, fork the conversation, or send the existing
draft as a separate message.
This is distinct from #185. The main request is reading and replacing
the active TUI draft, rather than generally replacing Ask with a
multiline input widget.
Describe the solution you'd like
Expose an opt-in "edit current TUI prompt" flow through
ask(). The exactpublic API is less important than the following behavior:
of appending to the old value.
/editor.Existing behavior for explicit calls such as: