Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can I replace multiline like this in vim?

Tags:

regex

vim

I want keep my js in this style. I want write a map in vim to do it faster.

from:

var a = x;
var b = y;
var c = z;

to:

var a = x
  , b = y
  , c = z
  ;
like image 469
guilin 桂林 Avatar asked Aug 20 '26 14:08

guilin 桂林


1 Answers

Use the following command.

%s/;\nvar /\r , /gc

like image 88
balki Avatar answered Aug 23 '26 19:08

balki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!