I know how to remove ^M
in my files (%s/^M//g
), but this one is just one line I\'d like to replace ^M
with enter... what\'s the enter char
To replace carriage return character (which is
) with line feed character (which is unix line break character) you should run a bit strange command:
%s/\r/\r/g
It looks like if it is doing nothing, but in regular expressions and double-quoted strings carriage returns are represented using \r
and line feeds with \n
, while in the replacement part of :s command and substitute() function they mean the opposite.
Note that in terminal Enter produces
, so your initial request is not valid.