echo "set mouse-=a" >> ~/.vimrc
echo "syntax on" >> ~/.vimrc```
echo "set pastetoggle=<F3>" >> ~/.vimrc
:set nu
:set nonu
end pattern with \c
:%s/toto/\c
:set paste
Then paste your code. Note that the text in the tooltip now says -- INSERT (paste) --.
After you pasted your code, turn off the paste-mode, so that auto-indenting when you type works correctly again.
:set nopaste
However, I always found that cumbersome. That's why I map such that it can switch between paste and nopaste modes while editing the text! I add this to .vimrc
set pastetoggle=<F3>