Tip #1496: replace ^M characters from MSWindows file
tip karma |
Rating 118/90, Viewed by 9645
|
Read and edit this tip on the
Vim tip wiki.
The wiki may have a more recent version of this tip.
created: |
|
January 31, 2007 13:56 |
|
complexity: |
|
basic |
author: |
|
ritesh wadekar |
|
as of Vim: |
|
5.7 |
Windows files has line feed and carriage return. When such files are copied to *nix like OS, vim / vi shows ^M characters at the end of each line.
To get rid of those ^M use:
1,$ s/^M//gc
or
% s/^M//gc
To type ^M hit ctrl+v first and then M.
<< Wrap a Visual hilight in an arbitrary HTML tag |
convert between C /* */ comments and C++ // comments >>
Additional Notes
Anonymous,
January 31, 2007 14:11
|
For ^M hit CTL-v then CTL-M or CTL-v enter
|
Anonymous,
January 31, 2007 14:24
|
one of the oldest topics ever, see vimtip #26
|
Anonymous,
January 31, 2007 23:28
|
Note that, for people using Vim with Windows keybindings, CTRL-V is (naturally) the paste operation;
so, to produce a ^M, you have to type CTRL-Q then CTRL-M
|
|