On Ruby Rogues a few weeks back, Ben Orenstein mentioned he tries to spend 15 minutes a day improving his workflow and tools. I decided to take this onboard and this week I looked into how to paste code in Vim without loosing its indentation.

1. Turn off autoindent.

:set paste

2. Paste code

3. Turn autoindent back on.

:set nopaste

I found the solution here.