Friday, May 22, 2015

Re: vim with Windows developments under linux and git

On 2015-05-22, Pierre Couderc wrote:
> I have the usual problems with ^M and some other ones in these cases.
>
> I vant to use vim to develop Windows apps under linux (building in
> some Windows VM), with vim under linux.
> I do not want to get rid of ^M, I want to keep all my files in some
> specialized directory in Windows format managed by git and vim.
>
> Is there somewhere an howto for "good practices", particularly to
> set vimrc ?
>
> And, cerise sur le gateau, vim should remain correct for normal linux
> files...

This behavior is controlled by the 'fileformat' and 'fileformats'
options. Vim already sets 'fileformat' according to the line
endings it finds when opening existing files. To have Vim set
'fileformat' as you want for new files, set 'fileformat' in your
~/.vimrc, for example:

au BufNewFile /path/to/specialized/directory/* set fileformat=dos

I don't know what you mean by "the usual problems with ^M". Unless
you are editing files with inconsistent line endings, Vim should
automatically set 'fileformat' correctly so that you don't even have
to think about which line endings you are using.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: