yrzepa
Last Updated: February 25, 2016
·
652
· sheerun
Photo on 08.01.2013 at 04.15

Auto indent pasted code in vim

vim

Add to .vimrc:

nnoremap <silent> = V`]=

Now, press = after pasting code.

1 Response
Add your response

8023
Fe0ce83e4e1683c3aeda7cb2160e06a1

instead of:

V`]

you can use:

gv

which reselect last select or paste.

Also, I'm not sure if I would like to have = remapped, gv= is still ok for me :)

edit:
I was wrong. gv will work only if p or P was used in visual mode.
I've got another mapping in my .vimrc:

noremap gV `[v`]

It would select last edited/pasted lines, so you can use gV=

over 1 year ago ·