Often times when I paste into vim I get cascading indents that are quite frustrating to fix. The result will look something like this
This is line one
This is line two
This is line three
This is line four
I’d like to know if there is a way that I could tell vim to align lines two through four with line one. If line one text is starting at cursor position 6 is there a way to say “make the next ten lines also start at position 6?”
To correct this cascading indentation, you can re-indent a block using
=. Select a visual block and type=or supply a motion:=4jto re-indent the next 4 lines.You might avoid the cascading indentations by setting
pastebefore pasting::set paste. After the paste:set nopaste.