Skip to main content
luke@terminal:/blog$ ls
luke@terminal:/blog$ cat opencode-tmux-getting-used-to-keybindings.md

Trying to use opencode inside tmux was a struggle

Created: 2026-04-16 | 2 min read

I usually run opencode in a simple WSL terminal window. Somtimes I have multiple instances across different tabs in my Terminal. I came across a video recently on Youtube talking about tmux. I never had a reason to avoid tmux — I just never set it up properly. After watchging the video I was convinced I needed to give it a go, so I decided to actually try running my workflow inside tmux. Turns out that wasn't so straightforward. A series of small issues made the initial attempts quite frustrating.

The Escape Key Did Nothing

First problem: I hit Esc to interrupt an agent mid-task. Nothing happened. Just sat there. I hit Esc again. Nothing. The agent kept running.

I'm not sure what I expected tmux to do with Escape, but apparently it intercepts the key for its own bindings and there's a delay before the key reaches the application inside. I wondered if opencode had a bug or just didn't work well with opencode.

Then I searched "tmux escape key not working" and found set -g escape-time 10 which reduces that delay. Shorter would be faster but 10ms worked. After that, Escape actually reached opencode.

But that alone wasn't enough for clipboard to work.

Copying Text Was Broken

Selecting text in tmux with the mouse didn't copy to my system clipboard. I'd select, paste somewhere else, and get nothing. This is on WSL2 with Ubuntu on Windows — so I have WSLg, which is the Windows layer that lets Linux GUI apps run on Windows 11. But something was intercepting it.

I tried:

  • Checking if WSLg was actually running — it was
  • Googled "tmux clipboard copy not working wsl2 in opencode" — that's how I found most of the solution

What actually fixed it was adding these to my ~/.tmux.conf:

set -g escape-time 10
set -g mouse on
set -g set-clipboard on
set -g allow-passthrough on

set -g mouse on enables mouse mode so I can select with the mouse at all. set -g set-clipboard on is the key one. It's been around since tmux 2.9 and it handles clipboard integration properly. set -g allow-passthrough on lets applications inside tmux access the system clipboard without tmux intercepting it first. That last one seems particularly relevant for WSL setups, though it might help on other platforms too.

I'm running tmux 3.4 — From what I've reda these settings should work on tmux 2.9+, which covers most reasonable install paths in 2026.

To reload after changing tmux.conf, run tmux source-file ~/.tmux.conf.

Still Getting Used to It

I'm still getting used to the keybindings and functionality inside tmux. I'm still building the muscle memory. The clipboard issue was the biggest blocker, now that works, so the rest is just practice.

The other opencode posts (permissions trap, nested commands) don't mention tmux because I wasn't using it. Now I am, and now I know why people talk about these specific settings. It's quite nice having so much flexibility inside a single terminal window.

I'm genuinely not sure how anyone uses tmux without these settings. Maybe they were just magic configuration I never had.