5

In certain text files, after doing a save in vim with :w, the output mentions [dos] as such:
"foo.txt" [dos] 38L, 193C

Why is [dos] displayed?

As a simple test, I've created a new file with vim on a FAT32 disk attached to my Mac. Those files don't display [dos] after a save in vim. I copied that file to /tmp (native MacOS format). Opening it there does not display [dos] upon a save in vim either.

So, foo.txt has Japanese characters. A portion looks like:



...




"foo.txt" [dos] 38L, 193C

some testing:

/tmp$ file -I foo.txt
foo.txt: text/plain; charset=utf-8

foo.txt life cycle:

  1. On XP I created lots of text files using TextEdit that had Japanese characters and saved to FAT32 file system (usb drive).
  2. They were archived into a ZIP format.
  3. That usb drive was attached and copied to my MacBook (MacOS Extended / Journaled).
  4. /usr/bin/unzip unarchived them, and here I am.

Text files are such a basic cross-platform file format. Obviously, "something" is different with those [dos] marked files... What flags a file as being a [dos] file?

1 Answer 1

5

What flags a file as being a [dos] file?

Line endings. Windows uses CR (carrage return) and NL (newline) characters. Old Mac plain text files use CR and macOS (and other Unix like systems) command line editors use NL.

1
  • 1
    facepalm. ah yes, the good old "CR" / "NL" scourge. ":set ff=unix" and ":set ff=dos" lets for toggling. thanks!
    – riverflows
    Mar 17, 2017 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .