Dan Fabrizio wrote:
Hi all,

Does anyone know why vim don't show the ^M characters in a file but vi does?

:set list in vim shows $ at the end of the lines but no ^M characters?
:set ff=unix
:w

This removed the ^M characters but I had to use vi to verify.

Is there some setting I'm missing that needed to show the ^M characters in
vim?

Thanks in advance,
Dan



        :verbose set ff? ffs?

If 'fileformats' (plural) includes "dos", the fact that you don't see a ^M when lines end in CR+LF is not a bug, it's a feature (which is not present in Vi, and I mean the original Vi, not Vim running in 'compatible' mode).

If 'fileformats' includes "dos", the 'fileformat' (singular) will be set to "dos" for files with CR+LF ends-of-lines, and all lines will be written with CR+LF unless you tell Vim not to, by using e.g. "setlocal ff=unix".

See for details:
        :help 'fileformat'
        :help 'fileformats'
        :help file-format
        :help file-read
        :help DOS-format-write
        :help Unix-format-write
        :help Mac-format-write

To check the ends-of-lines for a file loaded in a window:

        :setlocal fileformat?

The answer can take three possible values:

  fileformat=dos

The file contained CR+LF endings, and it will be written back using CR+LF endings. If 'fileformats' (plural) does not include "unix", it is possible that the file included one or more lines with LF-only endings; they will be "repaired" to CR+LF when you save the file.

  fileformat=unix

The file contains LF endings; any spurious CR's are shown as ^M

  fileformat=mac

The file contains CR-only endings.


Best regards,
Tony.
--
It would be nice if the Food and Drug Administration stopped issuing
warnings about toxic substances and just gave me the names of one or
two things still safe to eat.
                -- Robert Fuoss

Reply via email to