^M
.
To remove all control characters, under command mode
:%s/^M//g
Be aware that ^M
is created by pressing ctrl + v (^
) and then ctrl + M (M
).
The command is utilizing the Find and Replace under
vi
::[range]s[ubstitute]/{pattern}/{string}/[flags] [count]Ranges are
% - the whole file m,n - from line m to nPattern see vim reference.
Flags are
c - asks for confirmation at each replacement g - all the occurrences within a line i - case insensitiveCount means to repeat for n times starting from the current line