Getting strange characters when pasting into my iterm2 terminal

Notice the "00~" and "01~" in front of and behind my text. I do not see these characters when I cut and paste into a text editor or other places. How do I eliminate these special characters from appearing when I cut and paste into my iterm2 terminal?

49608 次浏览
low noreferrer">https://gitlab.com/gnachman/iterm2/issues/5698

-55966569" rel="noreferrer">bracketed paste mode and tried printf '\e[?2004h' to exit bracketed paste mode and repair the terminal and it worked well for me.

Adding set t_BE= to .vimrc to disable bracketed paste mode should fix this.

Solution in my case:

you may refer: https://gitlab.com/gnachman/iterm2/issues/5698

Paste printf '\e[?2004l' to the iTerm2 terminal and press enter afterwards.

I recently started encountering this behavior in iterm2 as well. Killing and restarting a session fixes it, but loses context. I found this comment about bracketed paste mode and tried printf '\e[?2004h' to exit bracketed paste mode and repair the terminal and it worked well for me.

Solution in my case:

I think it's a bracketed paste issue

    Paste printf '\e[?2004l' to the iTerm2 terminal and press enter afterwards.

  1. Edit -> Paste special -> Advanced Paste

  2. ode"

  3. Uncheck "Bracketed paste mode"

  4. Restart the terminal

  • Restart the terminal

  • iTerm2 → Preferences → Keys → double-clic to edit the target of ⌘v → Under Speed, set Chuck Size to 256B and Interchunck delay to 100ms.

    In the terminal window type reset, and press enter. And now, try pasting contents in terminal, it should work properly.

    I can't guarantee the conditions of this fix because I had been fiddling for a while with the solutions above, but what fixed the issue for me was to go to:

    printf '\e[?2004h' should solve the issue; also make sure to remove the trailing and starting junk characters.

    e issue for me was to go to:

    iTerm2 → Preferences → Keys → double-clic to edit the target of ⌘v → Under Speed, set Chuck Size to 256B and Interchunck delay to 100ms.

    To permanently disable bracketing paste mode, open the Preference, search "bracketing", uncheck "Terminal may enable paste bracketing"

    I had to do shell-->Hard Reset to make it work immediately

    printf '\e[?2004h' should solve the issue; also make sure to remove the trailing and starting junk characters.

    I had to do shell-->Hard Reset to make it work immediately