On Wed, 14 Jun 2006, Tim Chase wrote:

I have "set fileformats=unix,dos" at the bottom of my _vimrc,
but still see the ^M's.

My guess is that the file in question has one line that lacks a ^M in the line, and thus, it vim concludes that it must use unix-style line-endings. The likely culprit is the last line in the file.

You can clean them all up with

        :%s/^M$/

where ^M is entered by pressing ^V followed by ^M

Once you've gotten them all cleaned up, you can use

        :set ff=dos

and then write the file.

If problems keep cropping up in files, somebody else's editor is likely bunging stuff up.

Another way to clean up all the ^M's is to do

  :set ff=unix
  :w
  :e

Then to convert to DOS format, I'd recommend

  :set ff=dos eol
  :w
  :e

HTH.
--
Gerald

Reply via email to