Merging Blocks
Your problem with Vim is that you don’t grok vi was an e-book distributed as a Stack Overflow answer. You probably saw it crop up on Hacker News a year or so ago. As a result of this tour de force in web comments I now keep track of interesting Stack Overflow questions and answers.
A recent find that intrigued me was about merging multiple lines:
If you want to do this with just Ex commands
:5,8del | let l=split(@") | 1,4s/$/\=remove(l,0)/
In Vim, you can use the pipe character (|) to chain multiple Ex commands, so the above is equivalent to
:5,8del
:let l=split(@")
:1,4s/$/\=remove(l,0)/
Many Ex commands accept a range of lines as a prefix argument — in the above case the
5,8
before thedel
and the1,4
before thes///
specify which lines the commands operate on.
The discussion after the answer is also quite enlightening, and it has garnered 803 upvotes so far.