In vim command mode, type
Then, in vim edit mode, paste the text
Finally, in vim command mode, type
To make switch the paste option on or off easier, we may map the commands to a key or a key sequence. For instance, we can define a mapping ",p" to switch the paste option on or off in the vim command mode by adding the following code snippet into the .vimrc file (located at the $HOME directory),
let mapleader = "," nmap <silent> <leader>p :set paste!<CR> \ <Bar>:echo "Paste: " . strpart("OffOn", 3 * &paste, 3)<CR> set nopaste
The "echo" part above displays an indicator to show whether the paste option is on or off.