On 2011-09-07, wombatvvv wrote:
> Hi,
>
> I find if I use VIM in Windows, save the file and then open it in Linux, I
> got a whole heap of errors. It's something to do with the end-of-line
> character. In Linux it's detected as ^M and causes errors in .vim scripts.
>
> How do I get my Windows VIM to play nice with my Linux VIM?
Linux Vim doesn't like DOS line endings (CR-LF), but Windows Vim
accepts either DOS or Unix (LF) line endings. Therefore, a Vim
script or configuration file saved with Unix line endings will work
equally well with both Windows and Linux Vim.
I use one set of Vim configuration files for both Windows and Linux.
To help keep the line endings correct, I have a
~/.vim/after/ftplugin/vim.vim file that contains, among other
things,
setlocal fileformats=unix,dos
That's all I have to do for files that I create myself. Some Vim
scripts on vim.org or vim.sf.net are archived with DOS line endings.
Those I convert to Unix line endings with d2u or dos2unix on a Unix
system.
Regards,
Gary
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php