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

Mac text files w/o eol

Expand Messages
  • Reid Kleckner
    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
    Message 1 of 2 , Dec 1, 2003
    • 0 Attachment
      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.

      __________________________________
      Do you Yahoo!?
      Protect your identity with Yahoo! Mail AddressGuard
      http://antispam.yahoo.com/whatsnewfree
    • Benji Fisher
      ... 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
      Message 2 of 2 , 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
        :w

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

        :set ffs=unix,dos
        :e!

        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 ...

        :w
        :set ffs+=mac
        :e!
        :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
      Your message has been successfully submitted and would be delivered to recipients shortly.