Although, a similar question has been asked before from 5 years ago, I want state this hasn't been solved, at least for me using iTerm 2 Build 3.4.19.
Here is the old issue: Getting strange characters when pasting into my iterm2 terminal
Pasting a string with special characters into iTerm's CLI results in escaped slashes.
For example, pasting this string:
https://accounts.spotify.com/authorize?client_id=xxxxx&response_type=code&redirect_uri=http://localhost:3000&scope=playlist-read-private
results in:
https://accounts.spotify.com/authorize\?client_id\=xxxxx\&response_type\=code\&redirect_uri\=http://localhost:3000\&scope\=playlist
-read-private
I've tried Advanced Paste as shown here:
As you can see there is an option to Escape shell characters with \
which has not been enabled because that's exactly what I don't want. However, iTerm is adding in escaped characters regardless.
I've also tried running printf '\e[?2004h'
. This has failed.
I've also tried disabling Terminal may enable paste bracketing under Settings > Profiles > Terminal
.
Mind you when I paste my example string from above into the MacOS Terminal, I don't have any of these issues. Point being, there aren't any gremlins inside my string.
Is there something I am doing wrong?
This post has multiple answers: How to disable zsh substitution/autocomplete with URL and backslashes
For me what worked is :