On 13/06/12 16:25, ping wrote:
thanks Tony.
however I think I need a way to just "not display" instead of modifying
the file -- it might need to be shared with other people working in
other OS..
thanks anyway.
FYI attached is a file of mine with ^M displayed on beginning&ending of
each line.
a :%/\r//g will clear all ^M and make it looks clean...but I'm not sure
how it will display in windows..

regards
ping

After you do that, the file will probably look just the same i.e. without the ^M. If you want to make it readable in Notepad (as opposed to WordPad, Notepad++ etc. which can read Unix files i.e. with lines terminated by LF only), be sure to use

        :setlocal ff=dos

before you save the file. You won't see any difference in Vim, but Notepad will see the CR+LF ends-of-lines which it expects. It may see an additional empty line at the end but that's because of the (wrong) way Notepad interprets ends of lines.

I can't be sure because, just like you, I'm on a 64-bit Linux system. And how can I tell? By the mail headers.

You: User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Me: User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/16.0 Firefox/16.0a1 SeaMonkey/2.13a1


P.S. Your file seems to have a lone LF at the very begin. After

        :1d|e

(on the unmodified file) all end-of-line ^M characters should disappear, and the file should get ff=dos with no further action. The former second line, which used to be just ^M, has now become a new empty first line. Then you may remove the ^M characters at the begin of lines by :%s/\r// or even %s/^\r// if you want to avoid remove any ^M characters other than at the left margin.

I'd like to know how that file was created.


Best regards,
Tony.
--
Military intelligence is a contradiction in terms.
                -- Groucho Marx


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to