Tmux brackted paste issue

2026-03-02

While perfecting the perfect shade of blue for links, which mostly entailed copy/pasting the values from the default google color picker I came across a (sort of) bug in tmux and simple fix.

When pasting the color hex into nvim inside a tmux window, the hex trailed off with ^[[201~. Weirder was I couldn't do anything anymore, every character I entered was instead represented by the utf code. Even Ctrl-b was hijacked, I couldn't exit (n)vim (that brought back bad memories...), or close the pane. By pure luck, I discovered the copy/pasting something again into nvim gave me back full control.

I found this issue which explains the cause. tmux waits escape-time long after an ESC to decide if the following chars are part of a longer key sequence. Due to lag (or possibly Windows Terminal) and a short escape-time tmux no longer interprets [201~] as "End bracketed paste", it just takes the raw code and passes it through to the open program (nvim).

The solution (as mentioned in the issue comments) is to set a higher escape-time. There is a trade off - esc to normal mode being less snappy - so I'm still experimenting with the right time, but 50ms seems good so far.

I still don't understand why it was messing up my terminal that badly, or why pasting again fixed that...

Further reading

What's the effect of escape-time in Tmux? tmux manual, escape-time