1 of 2
Thomas F
  • 256
  • 1
  • 2
  • 6

I am going to suggest using Ctrl + v to make a block.

It sounds as if putting the second block after the first doesn't do what you want. However, if you put the first block in front of the second block, it should work.

So, if your cursor is over the a in apple, (and there is a space at the end of every item in the first block), you can do:

        /------ Delete the first block
^    ^ ^ ^ ^
|    | | | \--- Put the content of the first block before the second block
|    | | \----- Go to the first line of the second block
|    | |
|    | \------- Highlight the block to the end of every line
|    |
|    Go to bottom of first block
  Start Visual mode in Block version (Ctrl + v)


  1. Start a visual block (Ctrl + v)

  2. Go to bottom of the the block (2j)

  3. Go the the end of all lines ($)

  4. Cut (x)

  5. Go the the start of the next block (2j)

  6. Put before (P)

  7. Cleanup.

    This leaves a block worth of empty lines above the second (now expanded) block. This can easily be removed (with 4k4dd or kdgg, for example).

Caveat: This requires that all the lines in the top group end with a single space ( ).

One way to put a space at the end of every line is to select it all, and replace.

ggV}k:s/$/ /

Go to top of file (gg), start visual line block (V), go down a block (}), and up a line (k) (now the entire top block is selected), and press :: gets you to command mode with a starting line of :'<,'>. The replace is s/$/ /, which will replace the end of line ($) with a space ( ). It doesn't remove the end of line though, it just adds a space at the end.

So, to wrap up, to go from your first block to the second block, I would run (starting from apple):

Vjj:s/$/ /<enter>C^v2k$x4jPgg4dd
^---------------^       ^^ ^---^
Put a space @ end       *1    *3
                 ^-----^  ^
                 Cut top  2
*1 - Go down
*2 - Paste
*3 - Cleanup

I don't know why you are against macros, but another simple way to do it would be to use } to jump to between the two blocks, and delete the top item in the bottom block, them jump back to where you were using Ctrl + o (<C-o>), then put, go up a line, Join the new line to the first, and then advance (k) to the next line to start all over again.


Or, if I was creating a macro (in register t)


And then repeat with: @t, then @@, then 20@@, or however many times you want .

Thomas F
  • 256
  • 1
  • 2
  • 6