I played around with this a little and it seems like it really depends. First I had no problems, but then I created the following file:
0000000: 310a 320a 330d 0a34 0a 1.2.3..4. It's a simple Unix file with one incorrect CRLF instead of just LF. It is displayed the following way (using an empty ffs): ff=unix 1 2 3^M 4 ff=mac 1^J2^J3 ^J4^J ff=dos 1 2 3 4 IMHO the dos variant should rather look like 1^J2^J3 4^J It's even stated in the manual: "In DOS format (default for MS-DOS, OS/2 and Win32), <CR><NL> and <NL> are both interpreted as the <EOL>." "If 'fileformat' is "dos", a <CR> in front of an <NL> is ignored and a CTRL-Z at the end of the file is ignored." ...but is that the wished/expected behavior? I'm often working with XML files, where the line breaks are mixed (e.g. within CDATA LF and between tags CRLF). Usually I am not allowed to edit the XML, so I have to find out, where the error occurred. Thomas Ben Schmidt wrote: > The bug has been fixed in a recentish Vim patch--you can now explicitly enable > ff=dos when opening a file, and Vim will obey you. > > :e ++ff=dos > > I believe in this case Vim will treat CRLF and LF as line breaks, i.e. it will > silently convert single LF into CRLF. Single CR will show up as ^M in the > buffer. > > As long as unix is in your 'ffs' option, though, Vim will autodetect filetype > and > will turn to Unix line endings if it finds a missing CR. > > For more details on fileformat detection, and on specifying it explicitly when > opening a file, etc., see > > :help 'ff' > :help 'ffs' > :help ++opt > :help file-formats > > Remember, though, that this thread was about a bug Vim had where it would > sometimes ignore the ++ff=dos option. It has now been fixed, but only if you > have > a Vim complied with that patch in it will you have the benefit of the fix. I > don't > have time now to look up when it was fixed; someone else may be able to. > > Ben. > > > > [email protected] wrote: > > Hi, > > > > are there any news on that? I'm quite interested in that topic, since > > it nags me for severals years now. Unfortunately I had never time to > > analyze the problem or search the mailing lists. I had the same > > experience as Tony: If you have a file with mixed CR and CRLF, you > > can't enable ff=dos. Always an UNIX linebreak is assumed, though > > ff=dos is set. That way it is hard to find out, where the incorrect > > line breaks came in. I would prefer to see a linebreak for every CRLF > > (dos) and a ^J for every single CR. > > > > Regards, Thomas > > > > On Oct 23 2008, 12:16 am, Ben Schmidt <[email protected]> > > wrote: > >> John Beckett wrote: > >>> Ben Schmidt wrote: > >>>> If you could send me a reply when you see this, Bram, that'd > >>>> be good, just so I know it's in the pipeline. > >>> Bram announced that he was having a non-networked holiday and will return > >>> later. > >> Yeah, that's why I'm keen to get a confirmation from him when he does > >> see it; it could easily get lost in a big backlog! But I don't like > >> nagging people about things they *have* seen. > >> > >> Smiles, > >> > >> Ben. > > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
