Set pastetoggle in .vimrc file to paste the text/code properly which is copied from web page or windows text file.
When you copy paste the text/code from web page to vim, it will be something like below.
If you already have .vimrc file in your home directory, set the below variable in .vimrc file. After that close and re-open the file in vim then press i (for INSERT mode) then press <F2> (Functional 2 key) and paste the copied text.
- <F2> is not mandatory, you can set it to any functional key
- If you don’t want to deal with .vimrc file, you can use below commands as well.
:setpaste (paste mode)
:nopaste (turn off paste mode)