On 27/07/09 00:08, Xian Chen wrote:
> Hello,
>
> I try to replace the ^M in the attachment with newline character. But
> failed.
>
> How to do that?
>
> Thanks in advance,
That file has CR-without-NL ("Mac"-style ends of lines), except at the
end of the last line. So:
1) Make sure you have Vim 7.2 with "at least" patch 040 included (and
probably later ones too: the "current" version is 7.2.245).
:version
2) Open the file, telling Vim to use "Mac" file format (CR-only).
:new ++ff=mac tmp.html
3) Remove the spurious linefeed at the end of the last line
G$x
This is a Normal-mode command (three of them actually), not an
Ex-command like the rest.
4) Set the 'fileformat' to unix (LF-only) for that file.
:setlocal ff=unix
5) (Optional) You may or may not want to add -> at the end to close the
comment, and/or do some more editing.
6) Save and close the file
:x
Best regards,
Tony.
--
Oliver's Law:
Experience is something you don't get until just after you need
it.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---