I'm running Terminal on my Mac and SSH'ing into a Linux host. When I paste text, it will often capitalize the last character of whatever I'm pasting, and the cursor will turn gray and I won't be able to type additional characters or delete characters from whatever I pasted. My only two options at that point are to either ^C to break onto the next line without running the command, or hit enter and run the messed up command.
It doesn't happen 100% of the time. If I copy something and then repeatedly paste it into the shell, I'll see this issue occur about 50% of the time. I have no idea why it's apparently non-deterministic like this. I thought this might also be due to "bracketed paste" issues, but no matter how many times I run the commands printf '\e[?2004l'
and set enable-bracketed-paste off
, the issue persists. It even persists when I exit and re-SSH to the host with a fresh SSH session, so I know it's not due to some sort of leftover bad state in the SSH session. Can someone please help??? This is killing my productivity!
Here's an example of what the pasted text looks like when the issue occurs:
(The text I was trying to paste was ParameterKey=Stage
with a lowercase e
at the end)
I'm aware that other questions have been asked along these lines, like this one from Stack Exchange, but none of the answers on any of these posts have worked for me, so I think my problem may be slightly different than those...
i
key and it will then allow me to edit the text I pasted. This is the same key you'd use to enter "insert" mode in vim, so now I'm thinking it might have something to do with vim, but I still don't understand how that'd be possible given that the issue happens even on a fresh terminal where I've never opened vim. – Takamatsuecho zsh=$ZSH_VERSION bash=$BASH_VERSION
2) Runssh -t linux-host bash
, then paste to see if you still have problems 3) Runssh linux-host
followed byset -o emacs
, then paste. 4) Runssh -t linux-host vim
then typei
, then paste. – Linseylinseywoolseyzsh=5.9 bash=
2) Runningssh -t <linux-host> bash
seems to fix it! 3) Runningset -o emacs
also seems to fix it! 4) Runningssh -t <linux-host> vim
creates a very weird terminal experience where I'm not able to run commands or anything, it just looks like I'm in a vim editor – Takamatsussh -t linux-host zsh --no-rcs
then paste. If this fixes the problem, that could mean there are issues in initialization files like~/.zshrc, ~/.zlogin
etc. – Linseylinseywoolsey~/.zshrc
file, but I still have no idea what exactly it could be. My company has a whole bunch of stuff that they've automatically included in that file, so it must be something in all of that that's causing the issue... though I've asked my colleagues if they've experienced the same behavior and they say they haven't. Is there a particular culprit in the zshrc file that you'd recommend I look for? – Takamatsuunset zle_bracketed_paste
to the end of my~/.zshrc
file seems to have fixed it! I had tried usingset enable-bracketed-paste off
previously, but it didn't work... I guess I just needed to use the correct command to disable bracket paste. – Takamatsu