vim text specified start a new line
If there is such a text
11111111,22222222222,33333333333,44444444444
We want him to wrap the display, each comma end of the text. Then we might use %s/,/,\n/g
. But it actually does not work. Instead, use $s/,/,\r/g
.
If you learned C, it should be understood \n
as a newline, \r
carriage return. In Linux, each end of the line is \n
, and in the windows for the end of each line \r\n
.
In vim replacement model, \n
represents the end of the match line, and you want to insert a new row, you need to use \r
.
For example, the conversion of text and then converted into the original format it should be %s/,\n/,/g
.