Repository navigation
feat: Copy Mode for OpenCode #2755
Description
Summary
OpenCode currently lacks a proper copy mode, making it difficult for users to selectively copy text from chat
messages, code blocks, and other content displayed in the viewport. While basic message copying exists (ctrl+x y), users need vim/tmux-like copy mode for precise text selection and copying.
Problem Statement
Current Limitations
- No Keyboard-based Text Selection: Users cannot select text using keyboard only
- Limited Copy Functionality: Only entire message copying is available (
ctrl+x y) - Incompatible with tmux Copy Mode: OpenCode runs as a TUI application but doesn't integrate with tmux's copy
mode - Poor UX for Code Review: Cannot selectively copy code snippets, error messages, or specific parts of
responses - Mouse Dependency: Users must rely on mouse for text selection, which is inefficient in terminal
environments
User Impact
- Developers: Cannot quickly copy code snippets from AI responses
- Power Users: Keyboard-driven workflow is broken when needing to copy text
- Terminal Enthusiasts: Expect vim/tmux-like navigation and selection
- Accessibility: Mouse-dependent selection is not accessible to all users
Why Copy Mode is Essential
1. Terminal Workflow Compatibility
OpenCode is a TUI (Terminal User Interface) application that runs in terminal emulators. Terminal users expect:
- Vim-like navigation and selection
- Keyboard-driven text manipulation
- Integration with existing terminal tools
2. tmux Integration Problem
When OpenCode runs inside tmux:
- tmux's copy mode (
prefix+[) doesn't work properly, it only can select and copy one page that currently visible of opencode.
3. Pager-like Applications Need Copy Mode
OpenCode functions as a pager for chat messages and code:
- Similar to
less,more, orvim - All major pagers have copy/select functionality
- Users expect to be able to select and copy content
4. Developer Productivity
Developers using OpenCode need to:
- Copy code snippets from AI responses
- Select error messages for debugging
- Extract specific parts of long responses
- Maintain keyboard-driven workflow
What Already Exists (✅)
- Selection System:
type selection struct { startX int endX int startY int endY int }
• Mouse-based selection is implemented
• Coordinate tracking works correctly
2. Highlight System:
```go
type highlightInfo struct {
lineStart, lineEnd int
lines map[int][2]int
}
• Viewport has robust highlighting
• Multi-line highlighting supported
• SetHighlights(), HighlightNext(), HighlightPrevious() available
3. Navigation Keymap:
type KeyMap struct {
PageDown, PageUp key.Binding
HalfPageUp, HalfPageDown key.Binding
Down, Up key.Binding
Left, Right key.Binding
}• Vim-like keys already implemented: j/k, h/l, f/b, d/u
• Navigation system is mature
4. Clipboard Integration:
• cmds = append(cmds, app.SetClipboard(lastTextPart.Text))
• app.SetClipboard() function exists
• Toast notification system available
Activity
github-actions commentedon Sep 24, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
rekram1-node commentedon Sep 24, 2025
yeah copying could be better, tui is being rewritten currently so features like this can best be addressed after the fact.
Ultimately all ux goes through @adamdotdevin
jonahbenton commentedon Nov 19, 2025
Voting +1. Would also like selection by mouse and keyboard navigation.
itse4elhaam commentedon Dec 10, 2025
+1
This is one of the painpoints.
jkirkpatrick commentedon Jan 25, 2026
+1
The "Copied to Clipboard" notification is a lie - not an error or omission.
It should be removed (and gated behind a feature flag) until tested and confirmed working.
fadedlamp42 commentedon Feb 6, 2026
A decent workaround, for now, is to:
^x xto "Export session transcript"^wto clear out the default filename and replace with/tmp/s[croll] (or whatever you prefer)$EDITOR /tmp/sopens (nvimfor me) which provides access to the full conversation. A simpleGand you can pretend you're intmuxscroll modeEDIT: These make things not as bad, too
piraz commentedon Mar 2, 2026
What about a float window with raw script for keyboard users, or raw/partial raw to editor? That will go to neovim btw and inside there is fair game.
docs: assessment of next 4 upstream issues (anomalyco#2755, anomalyco…
leohenon commentedon Mar 20, 2026
I maintain ocv, an opencode fork with vim keybindings. It already supports visual mode with yank/put in the input. Full copy mode for the output buffer in the tui is coming soon.
brew install leohenon/tap/ocvsilentjay commentedon Mar 25, 2026
Superb work! I need to look into running this on
sidekick.nvimleohenon commentedon Mar 26, 2026
@silentjay Im currently working on integrating my fork with this plugin opencode.nvim by nickjvandyke for a sidekick type integration but with vim mode in the opencode tui.
leohenon commentedon Mar 26, 2026
On a side note, copy mode is now fully implemented in the latest release of ocv.
silentjay commentedon Mar 26, 2026
That's interesting as I was planning on giving
opencode.nvima whirl at some point as well, although at this point I don't think I could live without the copilot NES functionality ofsidekick.nvim!leohenon commentedon Mar 27, 2026
Interesting, I haven’t used sidekick's NES much, just copilot tabbing. I might give it a shot and look into running
ocvwithsidekick.nvimis possible.egoarka commentedon Apr 10, 2026
any progress? does not seem to work. tmux support?
egoarka commentedon Apr 10, 2026
just used mappings with xremap ( c-d / c-u ). and copy mode from alacritty.
AnatolyHohuda commentedon Apr 14, 2026
also wondering if Tmux copy mode support will be improved.
I'm mostly concerned about the text input at the bottom. sometimes questions/decisions tool is triggered by model and it takes up to 30% of the height of the terminal.
when that happens in the Claude Code I'm still able to scroll up with Tmux copy mode to take a look at things and then come back to the input. but in opencode, it's searching needle in the half of the screen height hay stack.
github-actions commentedon Jun 14, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.