Friday, May 22, 2015

Re: vim with Windows developments under linux and git

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iF4EAREIAAYFAlVfVwoACgkQRL8D6wymVNYJIQD/arX+3yIi35gaesTHfZ0/+u56
7fzrC2R3ZFdY5l70IgABAK1fNBJBZGdMjLZkoVu1+QWg5ggdXGlYXuSR5cosCkyf
=oniV
-----END PGP SIGNATURE-----
On 22 May 2015, at 17:00, Gary Johnson wrote:
> On 2015-05-22, Pierre Couderc wrote:
>> I have the usual problems with ^M and some other ones in these cases.
>>
>> <snip/>
>
> 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.

I've seen this in the past when a file, created in Windows with CR-LF line endings, doesn't have a line ending at end-of-file, so yes, that might be a case of 'inconsistent line endings'. In such cases I just do a global replace ':%s/<CTRL-V><CTRL-M>//' to get rid of the spurious characters and then settle on the desired file format

Regards, Andy


--
Andrew Long
Andrew dot Long at Mac dot com


--
--
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