Saturday, May 23, 2015

Re: vim with Windows developments under linux and git

On 2015-05-23, pcouderc12 wrote:
> Le vendredi 22 mai 2015 17:08:01 UTC+2, pcouderc12 a écrit :
> > 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...
> >
> > Thanks
> > PC
>
> Thank you Gary, thank you Andrew.
> My question is : Is there a howto or good practices for
> developping Windows apps unfer linux, git and vim environment.
> So the problem is not to remove rc-lf but more on the contrary
> to add them if missing...

I'll leave the issues of developing Windows applications under Linux
and configuring git appropriately for someone who understands those
issues better than I do.

As for line endings, there are three cases:
1. The file contains only CR-LF (DOS) line endings.
2. The file contains only LF (Unix) line endings.
3. The file contains both LF and CR-LF line endings.

In case #1, Vim will set the 'fileformat' to "dos" and not show any
^M characters. There is nothing you need to do.

In case #2, Vim will set the 'fileformat' to "unix" and of course
not show any ^M characters as there are none. The simplest way to
change the line endings to CR-LF is to execute the following.

:set ff=dos
:w

In case #3, Vim will set the 'fileformat' to "unix" and display a
^M character at the end of every line that has a CR-LF line ending.
The simplest way to change all the line endings to CR-LF is the
following.

:%s/\r$//
:set ff=dos
:w

HTH,
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:

Post a Comment