5 years ago
This will set paste mode on, insert the contents of your clipboard and then turn paste mode off again, all while retaining proper indentation.
Use it, if you regularly paste stuff from e.g. webpages into vim and are as tired as me of always having to exit insert mode, toggle paste mode, enter insert mode, paste and toggle again. This snippet will save you a lot of time!
map <Leader>p :set paste<CR>o<esc>"*]p:set nopaste<cr>