Every now and then I run into this type of editing problem in Vim.
I have text formatting in a table that I want to turn into a list.
Before:
AAA BBB
AAA BBB
AAA BBB
CCC DDD
CCC DDD
CCC DDD
After:
AAA
AAA
AAA
BBB
BBB
BBB
CCC
CCC
CCC
DDD
DDD
DDD
Of course not as trivial as this example. The blocks can have hairier contents, larger and inconsistent numbers of lines, etc.
The way I do it now seems to be a bit of a hack:
CTRL-q
in the Windows version to select the top-left corner.d
to cut the block.SHIFT+p
to paste the block into this area.Step is the rough part.
Doing a normal non-block cut or copy will always paste into "new" lines. A kind of "insert" or "append" operation. Doing a block cut or copy will normally paste in a kind of "overwrite" mode.
Is there a better way to copy or cut in "block mode" but paste in "insert / append mode"?
The ex command :put
will always paste a register line wise.
Cut the block of text with visual block mode like you have before then execute :put
instead of p
.
If you want to "cast" pastes in more ways then use @Ingo Karkat's plugin.
For more information see:
:h pu
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With