I'm running Terminal on my Mac and ssh'ing into a Linux host. I've had 2 issues around copying and pasting text into my Terminal:
- When I'm just running local Terminal commands on my Mac (not though ssh), I sometimes get weird characters around text that I paste, like
00~pastedtext01~
. I googled around and found out that this was apparently due to "bracketed paste". I was able to fix this problem by running the commandprintf '\e[?2004l'
whenever it happens. - When I ssh into my 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 90% 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'
andset enable-bracketed-paste off
, the issue persists. It even persists when I exit and re-ssh to the host, so I know it's not due to running any program like vim, since the problem still happens even immediately after I've ssh'ed into the host. Can someone please help??? This is killing my productivity!
Here's what a paste with this issue looks like:
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. – Dasmowenator Dec 31 '19 at 18:18