claude-code - 💡(How to fix) Fix [BUG] Ctrl+G editor: pasting text (Cmd+V) produces duplicated/garbled output in tmux

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

No error messages. The symptom is duplicated/garbled text in the editor buffer after pasting. For

Code Example

No error messages. The symptom is duplicated/garbled text in the editor buffer after pasting. For
  example, pasting a two-line URL produces six lines with the content repeated multiple times.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When opening an editor via Ctrl+G (e.g. Vim), pasting text with Cmd+V produces duplicated/garbled output. The pasted text appears repeated and mangled, regardless of Vim's paste mode setting (:set paste or pastetoggle). This only occurs in the Ctrl+G editor — pasting in Vim outside of Claude Code works correctly, even in the same tmux session.

What Should Happen?

Text pasted with Cmd+V into the Ctrl+G editor should appear exactly once, unmodified, matching the clipboard contents.

Error Messages/Logs

No error messages. The symptom is duplicated/garbled text in the editor buffer after pasting. For
  example, pasting a two-line URL produces six lines with the content repeated multiple times.

Steps to Reproduce

  1. Run Claude Code inside tmux (tmux 3.5a, TERM=screen-256color)
  2. Press Ctrl+G to open the editor (Vim 9.1)
  3. Press i to enter insert mode
  4. Paste any multi-line text with Cmd+V
  5. Observe that the pasted text is duplicated/mangled

Suspected cause: Claude Code's PTY input handling remains active during the Ctrl+G editor subprocess, so both Claude Code and Vim read the pasted input from the PTY, producing duplicated text.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.111

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

My full setup is iTerm2 running et, connecting to a remote Linux machine, running tmux on that machine, and running claude CLI on that terminal.

extent analysis

TL;DR

Disabling PTY input handling in Claude Code during the Ctrl+G editor subprocess may resolve the duplicated/mangled text issue when pasting with Cmd+V.

Guidance

  • Investigate Claude Code's PTY input handling configuration to determine if it can be disabled or modified to prevent interference with Vim's input handling.
  • Verify that the issue is specific to the Ctrl+G editor subprocess by testing paste functionality in other editors or terminals.
  • Check if there are any existing configuration options or workarounds in Claude Code or Vim that can mitigate this issue.
  • Consider testing with a different version of Vim or Claude Code to see if the issue is version-specific.

Example

No code snippet is provided as the issue is related to configuration and interaction between Claude Code and Vim.

Notes

The suspected cause of the issue is related to PTY input handling, but further investigation is needed to confirm and resolve the issue. The fact that this worked in a previous version suggests that a configuration change or update may have introduced the issue.

Recommendation

Apply workaround: Investigate and potentially disable PTY input handling in Claude Code during the Ctrl+G editor subprocess, as this is the most likely cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING