Unable to replace a space with a new line in Vim

:%s/ /Ctrl vReturn/g

Where Ctrl v is Control-key plus key v and Return is the return key (the one on the main keyboard, not the enter key on the numpad). The other characters are typed as usual.

If this is entered correctly, the sequence Ctrl vReturn will display as the characters ^M, typically in a different color, to indicate that they are special. Note that actually typing ^M will not work.

Also note that in Vim for windows, it’s Control-q instead of Control-v (as that is paste).


Ctrl-v also allows entering other “special” keys via the keyboard. It is also useful for e.g. Tab or Backspace.

Leave a Comment

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