Prevent indentation when pasting from an external source in Vim

Occasionally when I copy and paste something from an external source into Vim every line gets indented, which is probably not something you want when pasting a code snippet.

The solution to this problem is an easy one. Before pasting, first execute :set paste, then paste your content and to return the setting to its previous value execute :set nopaste.

Problem solved!

Scroll to Top