2008/12/5 fritzophrenic <[EMAIL PROTECTED]>: > > On Dec 4, 8:24 am, "Yongwei Wu" <[EMAIL PROTECTED]> wrote: >> Strictly speaking, my results make more sense. Vim help file does not >> say that the first value in ffs will be used as the default encoding. > > Indirectly, it does. > > :help 'ffs' gives: > > 1. If all lines end in <CR><NL>, and 'fileformats' includes "dos", > 'fileformat' is set to "dos". > 2. If a <NL> is found and 'fileformats' includes "unix", > 'fileformat' > is set to "unix". Note that when a <NL> is found without a > preceding <CR>, "unix" is preferred over "dos". > 3. If 'fileformats' includes "mac", 'fileformat' is set to "mac". > This means that "mac" is only chosen when "unix" is not present, > or when no <NL> is found in the file, and when "dos" is not > present, or no <CR><NL> is present in the file. > Also if "unix" was first chosen, but the first <CR> is before > the first <NL> and there appears to be more <CR>'s than <NL>'s > in > the file, then 'fileformat' is set to "mac". > 4. If 'fileformat' is still not set, the first name from > 'fileformats' is used. > > For new files created in Vim, there are no line endings yet in the > file, so 1, 2, and 3 all fail. Hence, 4 "defaults" to deciding that > "the first name from 'fileformats' is used. > > This is actually specified explicitly in :help :new and :help :enew: > > "If 'fileformats' is not empty, the first format given will be used > for the new buffer." > >> I >> would rather think your environment affected. Did you try with -u >> test.vim, as I did? >> > > No, but I tried like this: > > gvim -N -u NONE -i NONE > :set ffs=unix,dos > :tabnew > :set ff? > > fileformat=unix > > gvim -N -u NONE -i NONE > :set ffs=unix,dos > :new > :set ff? > > fileformat=unix > > gvim -N -u NONE -i NONE > :set ffs=unix,dos > :enew > :set ff? > > fileformat=dos > > That last one is interesting. Especially since it is in direct > contradiction to :help :enew above.
Our results are aligned then. I only check the ff of the empty file on opening vim and the result of :enew. Neither is affected by ffs. When I try :new and :tabnew now, you results can be reproduced. However, since :enew and the default empty file does not work as you expected, your method is not reliable. Probably you want to file a bug report to Bram. Best regards, Yongwei -- Wu Yongwei URL: http://wyw.dcweb.cn/ --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
