Vim paste mode or how to avoid paste autoformat
Every time you paste code on your buffer from your clipboard (if you use vim on a terminal) it will auto indent or auto comment in a top to bottom way your lines of pasted code.
If you want to avoid this behavior you simply have to switch to paste mod via:
:set paste
of course it's easier to map it on the keyboard like this:
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
Now F2 will set your insert mode on.
Hope it helps!
Written by Marín Alcaraz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#