In Vim how do I split a long string into multiple lines by a character?

Give this a try:

:s/"https://stackoverflow.com/"\r/g

The above will work on the current line.

To perform the substitution on the entire file, add a % before the s:

:%s/"https://stackoverflow.com/"\r/g

Breakdown:

:    - enter command-line mode
%    - operate on entire file
s    - substitute
/    - separator used for substitute commands (doesn't have to be a /)
|    - the pattern you want to replace
/    - another separator (has to be the same as the first one)
|\r  - what we want to replace the substitution pattern with
/    - another separator
g    - perform the substitution multiple times per line

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)