Skip to content

feat: add_visual_selection_inline should support non-file buffer - #442

Merged
sudo-tee merged 1 commit into
sudo-tee:mainfrom
phanen:feat/reply-opencode-output
Jul 3, 2026
Merged

feat: add_visual_selection_inline should support non-file buffer#442
sudo-tee merged 1 commit into
sudo-tee:mainfrom
phanen:feat/reply-opencode-output

Conversation

@phanen

@phanen phanen commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
opts.keymap.output_window = {
  ['r'] = { 'add_visual_selection_inline', mode = { 'v' } },
}

```
opts.keymap.output_window = {
  ['r'] = { 'add_visual_selection_inline', mode = { 'v' } },
}
```
@phanen
phanen force-pushed the feat/reply-opencode-output branch from 5f2c4de to 3aa07d1 Compare July 3, 2026 07:18
@sudo-tee

sudo-tee commented Jul 3, 2026

Copy link
Copy Markdown
Owner

This is a nice adition, and a workflow I dind't know I needed :)

Thanks again for another great little PR

@sudo-tee
sudo-tee merged commit af4e1a8 into sudo-tee:main Jul 3, 2026
5 checks passed
@phanen
phanen deleted the feat/reply-opencode-output branch July 3, 2026 15:18
@jensenojs

Copy link
Copy Markdown
Collaborator

Sorry to jump in here. I was browsing recent PRs and was pleasantly surprised by this one. The profiling trick from #450 was also a very useful thing to learn.

This PR made me rethink #318 a bit. Maybe the diff-review workflow I was imagining there was too heavy. What I actually want most of the time is simpler: while looking at any interesting part of Neovim — a code selection, a diff hunk, an opencode output block, a plan, or any temporary buffer — I want to select it, send it into the opencode input, and add a comment around it.

From that angle, add_visual_selection_inline feels close to a more general primitive than add_visual_selection. It works even when the current buffer is not a file, and the result is visible/editable in the input, which is exactly what I want for “comment on this” workflows.

I’m not sure whether add_visual_selection and add_visual_selection_inline should be merged. Maybe they should stay as two sinks for the same captured selection:

  • persistent structured context: add_visual_selection
  • editable one-shot prompt text: add_visual_selection_inline

One related question: do you use add_visual_selection often in your daily workflow? For me, selections added to context are usually useful for only one message. After that I often want them gone, but right now I think I have to clear them manually. That makes the persistent context a little awkward for this kind of workflow.

Maybe a small “one-shot selection / quote selection into input” mechanism would cover most of the use case from #318 without needing a dedicated diffview workflow. @phanen

@phanen

phanen commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

One related question: do you use add_visual_selection often in your daily workflow? For me, selections added to context are usually useful for only one message. After that I often want them gone, but right now I think I have to clear them manually. That makes the persistent context a little awkward for this kind of workflow.

tbh I never use add_visual_selection after I know there's add_inline version

@sudo-tee

sudo-tee commented Jul 8, 2026

Copy link
Copy Markdown
Owner

For my part I do use add_visual_selection almost daily.

@jensenojs

Copy link
Copy Markdown
Collaborator

For my part I do use add_visual_selection almost daily.

Ah, you probably use it more frequently than I do, so do you think the way it's being constantly cited is reasonable? I'm a bit unsure.

@sudo-tee

sudo-tee commented Jul 8, 2026

Copy link
Copy Markdown
Owner

They should be cleared once sent, If they are not it's a bug.

disrupted pushed a commit to disrupted/opencode-native.nvim that referenced this pull request Jul 23, 2026
…o-tee#442)

```
opts.keymap.output_window = {
  ['r'] = { 'add_visual_selection_inline', mode = { 'v' } },
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants