New answers tagged

1

I've answered this before, but the general strategy is this: globally join from the start of a paragraph to the end (given by /^$/-). But we have to handle the last line of the document specially. The easiest version is :$put ='' :global/./,/^$/-join :$delete where we make a blank line at the end, do our join (which doesn't fail on the last line, now), and ...


1

How I would probably approach this: Navigate: possibly something like /if then $; the goal is to be on the curly brace for the % key. Or you could just get inside the curlies for a{ Change: cV% or cVa{ and type if_function() Change populates a register. If I had more of the same edit, I would first navigate again (maybe n?) and then . to repeat. When I’m ...


1

found how to paste register ctrl+r so I enter to visual mode, and marked the block shift+ v 4j and used the replace command: :%s/^Rf/if_function/g


0

Answering my own question: It's a bit hackish, but you can hijack ripgrep's --replace flag, you can essentially replace each match with a single line one, producing the desired effect. In the end, what I did is the following: :gr '/\*\*\n \* @Id\n \* @Column.*"integer"\)\n \* @GeneratedValue.*\n \*/' --multiline tests/ -r 'whatever, ...


Top 50 recent answers are included