Toggle auto-indenting for code paste in vim
Pasting text into a terminal running Vim with ‘autoindent’ or ’smartindent’ set can destroy the indenting of the pasted text.
How to solve this problem?
Before paste
:set paste
After paste
:set nopaste
Or we can just add this in .vimrc config file, so that we can make a toggle for this action.
set pastetoggle=<F9>
Reference:Toggle auto-indenting for code paste
