Reputation: 2117
In vim, how do you deal with situations where you copy something that uses 4 spaces as an indent to 2 spaces?
Is there a way I can specify a number so that vim can use the correct indent size?
Upvotes: 0
Views: 56
Reputation: 196856
You can use [p
and ]p
to put text with the indent of the current line.
See :help ]p
.
Upvotes: 1
Reputation: 3541
If you have your shiftwidth
and tabstop
set to 2
already, you can paste the text, select the text you just pasted and re-indent those lines.
Something like:
nnoremap pi p`[v`]=
So using pi
will paste your text, select it and re-indent it.
Upvotes: 2