On Dec 2, 10:58 pm, "Yongwei Wu" <[EMAIL PROTECTED]> wrote:
> 2008/12/3 fritzophrenic <[EMAIL PROTECTED]>:
>
>
>
> > For *NEW* files to default to dos format, all you'd need to do is (in
> > your vimrc) :set ffs=dos,unix,mac or :set ffs=dos,unix instead of the
> > default ffs=unix,dos.
>
> It does not work for me. :set ff=unix in _vimrc works for me, but
> only before I open a new a DOS file. It seems nothing works stably
> for new file (on Windows) to achieve your purpose.
>
What exactly "doesn't work" about it?
If you set ffs (note the 's' at the end, to get the fileformatS option
and not the fileformaT option) to unix,dos in Windows, every NEW file
you create WITHIN Vim should have a unix encoding. However, if you
edit an EXISTING file from within Vim, possibly even an "empty" one
that you just created from somewhere else, Vim will automatically
detect the line ending style that already exists in the file. This is
most certainly desired behavior!
If you want to override the 'ffs' option for certain file types on a
read, you can put "setlocal ff=unix" or whatever is desired in an
autocmd or ftplugin file, as has already been suggested.
For example, although I like most of my files to have unix line
endings, and thus have "set ffs=unix,dos" in my vimrc, I like to have
dos line endings in my DOS batch files, so in $HOME/vimfiles/ftplugin/
dosbatch.vim, I have "setlocal ff=dos" to automatically enforce the
dos line endings on all dos files when created or read.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---