Last Updated: February 26, 2019
·
1.591K
· wkjagt

vim pasting without making a mess

If you have auto-indenting enabled in vim, you probably know what a mess you get when you paste a block of code in it. Luckily, vim has something called paste mode :

  • before pasting : :set paste
  • after pasting : :set nopaste

2 Responses
Add your response

Or you can use gp instead p.

over 1 year ago ·

don't forget to set this on a key in your .vimrc:

set pastetoggle=<F2>

(http://vim.wikia.com/wiki/Toggle_auto-indenting_for_code_paste)

over 1 year ago ·