string/blob arg as context support #52

Closed
opened 2026-02-16 17:24:58 -05:00 by yindo · 5 comments
Owner

Originally created by @albertilagan on GitHub (Jun 14, 2025).

Originally assigned to: @thdxr on GitHub.

similar to opencode run [message..], it would be nice if I can pass [message..] on opencode as well which should serve as the initial context similar to opencode [project].

My usecase is I'm trying to run opencode on neovim by opening a new tmux tab/window.

vim.keymap.set('n', '<leader>ch', function()
  local cwd = vim.fn.getcwd()
  local cmd = string.format("tmux new-window -c '%s' 'opencode'", cwd)
  os.execute(cmd)
end, { desc = 'Open tmux tab with opencode' })

What I wanna achieve is, when I have text selected on neovim I want to hit a few keys that will open a new tmux tab and run opencode with the selected text as initial context.

Originally created by @albertilagan on GitHub (Jun 14, 2025). Originally assigned to: @thdxr on GitHub. similar to `opencode run [message..]`, it would be nice if I can pass `[message..]` on `opencode` as well which should serve as the initial context similar to `opencode [project]`. My usecase is I'm trying to run `opencode` on neovim by opening a new `tmux` tab/window. ```lua vim.keymap.set('n', '<leader>ch', function() local cwd = vim.fn.getcwd() local cmd = string.format("tmux new-window -c '%s' 'opencode'", cwd) os.execute(cmd) end, { desc = 'Open tmux tab with opencode' }) ``` What I wanna achieve is, when I have text selected on neovim I want to hit a few keys that will open a new tmux tab and run `opencode` with the selected text as initial context.
yindo closed this issue 2026-02-16 17:24:58 -05:00
Author
Owner

@albertilagan commented on GitHub (Jun 14, 2025):

for additional context I'm using avante with neovim, but my experience is hit or miss. hence why i'm looking on opencode as alternative.

@albertilagan commented on GitHub (Jun 14, 2025): for additional context I'm using avante with neovim, but my experience is hit or miss. hence why i'm looking on `opencode` as alternative.
Author
Owner

@thdxr commented on GitHub (Jun 14, 2025):

just so i understand - opencode <message> should start opencode and send that message as the first chat? or just fill it into the input and you can press enter

@thdxr commented on GitHub (Jun 14, 2025): just so i understand - `opencode <message>` should start opencode and send that message as the first chat? or just fill it into the input and you can press enter
Author
Owner

@albertilagan commented on GitHub (Jun 14, 2025):

just so i understand - opencode <message> should start opencode and send that message as the first chat? or just fill it into the input and you can press enter

probably best not to send it right away, at first I was thinking to not pre-fill it and just attach it on their first chat, but ux wise it's probably better to show it on tui so maybe pre-fill is better?

@albertilagan commented on GitHub (Jun 14, 2025): > just so i understand - `opencode <message>` should start opencode and send that message as the first chat? or just fill it into the input and you can press enter probably best not to send it right away, at first I was thinking to not pre-fill it and just attach it on their first chat, but ux wise it's probably better to show it on tui so maybe pre-fill is better?
Author
Owner

@albertilagan commented on GitHub (Jun 14, 2025):

for inspo it looks like this on avante when I highlight some code and activate avante.

Image

@albertilagan commented on GitHub (Jun 14, 2025): for inspo it looks like this on avante when I highlight some code and activate avante. ![Image](https://github.com/user-attachments/assets/6b1b8dbb-6602-4f8a-a7c3-14fc9f6ed15f)
Author
Owner

@rekram1-node commented on GitHub (Oct 7, 2025):

maybe not exactly what you want but a while back this got added:

opencode -p <prompt>

believe that closes this

@rekram1-node commented on GitHub (Oct 7, 2025): maybe not exactly what you want but a while back this got added: `opencode -p <prompt>` believe that closes this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#52