Auto indent pasted code in vim
Add to .vimrc:
nnoremap <silent> = V`]=
Now, press =
after pasting code.
Written by Adam Stankiewicz
Related protips
1 Response
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#