Repository navigation
Ghostty + tmux [extended-keys on] + neovim = broken newlines #12717
Unanswered
kuzemchik
asked this question in
Issue Triage
Replies: 1 comment
|
I'm seeing what I think is the same effect when using UW PICO 5.09 (the standard terminal text editor shipped with modern macOS) inside of tmux 3.6b (installed via Homebrew) on Tahoe 26.5.1, but I'm not able to find a tmux config that doesn't display this behavior. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Issue Description
Problem
After enabling tmux's extended-keys reporting (used by Neovim 0.11+ and
several TUI agents) with a single line:
multi-line pastes from Ghostty into Neovim through tmux render newlines as
tmux's modified-key escape sequence for
Ctrl+J(e.g.\e[27;5;106~) inthe buffer instead of inserting line breaks.
The behavior requires all three of:
extended-keys onNeovim 0.11+ does this automatically; a plain shell or
catrunning inthe same tmux session does not, and is not affected.
Replacing any one of the three layers changes the behavior:
\e[27;5;106~(encoded Ctrl+J)\nline break\nline breakextended-keys off\nline breakFix: kuzemchik@469c215
Expected Behavior
Newlines are inserted as new lines
Actual Behavior
Newlines are inserted as escape sequence for
Ctrl+J(e.g.\e[27;5;106~)Reproduction Steps
Repro
Minimal tmux config:
Steps:
tmux -L repro -f /tmp/repro-tmux.confnvim --clean /tmp/out.txti, ⌘V a multi-line clipboard (e.g.),
Esc,:wq4.
xxd /tmp/out.txtshows the modifier-key escape sequence between contentlines instead of
0a:Investigation
tmux was run with full byte logging (
tmux -L repro -vvvv -f …) and theserver log was inspected for the actual paste in both Ghostty and iTerm2,
same nvim / tmux session / paste contents.
Ghostty
After tmux has already entered bracketed-paste state from
\033[200~, thepaste content arrives in the next read:
(Capture taken with
extended-keys-format csi-u. The minimal repro usesthe default
xtermformat, which produces an equivalent sequence in adifferent shape — the rest of the analysis is the same.)
tmux parses each byte inside the bracketed-paste region as a keystroke. The
\n(0x0a) bytes are classified asCtrl+J(0x20000000006a) and, withextended-keys on, sent throughinput_key_extended, which writes themodified-key escape sequence to the pane. Neovim, in paste-verbatim mode,
inserts whatever it receives between
\033[200~and\033[201~as literaltext — including the encoded sequence.
iTerm2
The same paste arrives at tmux as:
iTerm2 uses
\r(CR,0x0d) as the line separator inside bracketed pastecontent, not
\n. tmux classifies\ras the named "Enter" key(
0xd, no modifier), so it does not go throughinput_key_extendedandis written to the pane as a raw
\r. Neovim inserts it as a line break.Ghostty Logs
No response
Ghostty Version
OS Version Information
macOS 26.4.1 (25E253)
(Linux only) Display Server
None
(Linux only) Desktop Environment/Window Manager
No response
Minimal Ghostty Configuration
# empty config is fineAdditional Relevant Configuration
Versions
Minimal tmux config
I acknowledge that:
```) on separate lines.All reactions