Maslow
Maslow

Reputation: 18746

How do you replace with a newline in VsCode Vim

None of the suggestions found here work, nor does a search on issues in the repo turn up anything.

I'd like to replace all >< with >\r\n< inside a selection

'<,'>s/></?/g

what goes in place of the question mark?

Upvotes: 8

Views: 3072

Answers (2)

Neil Barnwell
Neil Barnwell

Reputation: 42125

I just had success a moment ago moving asterisks to the start of a new line (i.e. replace asterisk chars with newline + asterisk) with:

:%s/\*/\r*/g

for clarity, that's:

:%s   (replace in whole file)
\*    (literal asterisk)
\r*   (new line followed by literal asterisk)
g     (operate on all matches on any given line)

Upvotes: 2

ffledgling
ffledgling

Reputation: 12140

Does this work for you?

:'<,'>s/></>\r</g

Are you on windows and trying to insert both (literal) \r (carriage return) and \n (new line) ?

Upvotes: 3

Related Questions