Linux

Disable auto-indent temporarily when pasting text into vim

So who loves vim? Not a fan myself but vim is a good fit for quick edit or config edit. Depending on your configuration, vim may be configured for smart indent where it can indent automatically after pressing enter key when it make sense, ex: if else block of code. This makes it annoying if you paste content into vim, breaking indention.

Do the following every time you paste content into vim:

Before paste, type:

:set paste

Then after paste, type:

:set nopaste

Leave a reply

Your email address will not be published. Required fields are marked *