Loading ...
Sorry, an error occurred while loading the content.

1223Re: Mac text files w/o eol

Expand Messages
  • Benji Fisher
    Dec 2, 2003
    • 0 Attachment
      On Mon, Dec 01, 2003 at 08:07:37PM -0800, Reid Kleckner wrote:
      > When one edits a text file with carriage return line
      > breaks, if the one at the very end of the file is
      > missing Vim doesn't recognize the file as being Mac
      > format. This is especially troublesome when working
      > with BBEdit users, because by default at least it
      > doesn't put a line break at the end of the file.
      > Surely this is a flaw, or is there some other reason
      > for this strange behavior? Unix and DOS file formats
      > work when they are missing their final line break, but
      > not on Mac.

      Are you sure you have diagnosed this correctly? I tried the
      following experiment (on my Linux box, but it should work the same on
      any platform ... should ...)

      $ vim foo.txt
      :set ff=mac

      I now have a file with Mac-style line endings. I want vim not to
      recognize it.

      :set ffs=unix,dos

      I have one long line with a <C-M>, displayed as ^M, at the end (and
      several in the middle). I delete the final one and then ...

      :set ffs+=mac
      :set ff?

      Now I have a file with Mac-style line endings, properly recognized by
      vim, with a single <C-J>, displayed as ^J, at the end.

      Have you read the description under

      :help 'ffs'

      about how vim decides what the file format is?

      HTH --Benji Fisher
    • Show all 2 messages in this topic