Thomas Michael Engelke wrote:
2007/5/14, Andy Wokula <[EMAIL PROTECTED]>:
Thomas Michael Engelke schrieb:
> :set fileformats?
>
> gives
>
> "fileformats=dos,unix", so both formats are available, yet the
> detection and switching does not seem to work.

Are you sure _every_ line ends in "^M"?

Positive. Every single line shows an ^M at the end. "set fileformat"
gives "unix" after loading. Setting fileformat to "dos" doesn't change
the files interpretation in vim. Somehow I think I miss something.


If 'fileformats' includes "dos", then if _all_ lines end in CR+LF, the 'fileformat' should be set (locally) to "dos".

But a single line without a CR causes 'fileformat' to be set to "unix", and all other lines show a ^M

Test 1:

Load the file. Then:

        /[^[:return:]]$

If there is a line ending in LF-without-CR, this search should find it.

Test 2, variant a: To remove all carriage-returns at end-of-line:

        :set fileformats=
        :e ++ff=dos filename
        :setlocal ff=unix
        :w

Test 2, variant b: to repair any lines where a CR is missing, (by adding it):

same as 2a, but omit the line with ":setlocal ff=unix".


Then exit Vim and reload the file with your usual settings to see if the problem has gone away. If it hasn't, do you still see it with

        vim -u /usr/local/share/vim/vim71/vimrc_example.vim

(replace the path if necessary by wherever Vim sets $VIMRUNTIME on your installation: on Windows it might be

        vim -u "C:\Program Files\Vim\vim71\vimrc_example.vim"

instead)?



Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
236. You start saving URL's in your digital watch.

Reply via email to