2007/5/15, A.J.Mechelynck <[EMAIL PROTECTED]>:
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)?

Hello Tony, and thanks for your extensive answer. Unfortunately, this
is what I can report. To make things easier, I'll attach the file I am
talking about to this message so that you can either check for
yourselves and/or see that I'm telling the truth.

What is the current state: Of course, there's one line without 0x13
0x10 at the end, and that is the last line. As I checked using your
regex (I'm always forgetting the :word:-syntax is available as well,
which makes it difficult as I can never remember how to search for a
hex char), I found one single line except the last one without 0x13
0x10 at the end. I removed the line in joining it with the line above
(multi line command) and saved the file. I closed it, closed vim and
reopened the file again. The problem persists. Now the only line your
regex finds is the last one. "set fileformats" still evaluates to
"dos,unix". "set fileformat" after loading the file evaluates to
"unix". Setting it to "dos" via "set fileformat=dos" does not help the
issue.

The example file of vim (in my case,
c:\Programme\vim\vim71a\vimrc_example.vim) loads fine and gets the
fileformat "dos", as expected.

Thank you for your help, guys.

Thomas

--
GPG-Key: tengelke.de/thomas_michael_engelke.asc

Attachment: list02.p
Description: Binary data

Reply via email to