Monday, August 17, 2015

Re: displaying ^M carriage returns in a file, like the 'old' vi used to do

2015-08-17 20:54 GMT+03:00 Nikolay Pavlov <zyx.vim@gmail.com>:
> 2015-08-17 20:34 GMT+03:00 <bigfootnlc@gmail.com>:
>> Greetings:
>>
>> I'm certain there are multiple ways this question has already been answered, between the lines, in previous posts regarding removing the ^M carriage returns from files when using vim. Apparently I'm not smart enough to decipher the chatter...
>>
>> We recently ran into a case where we believed a file to be 'clean' of these pesky characters, but it turns out it was not. We all wished we were back on Solaris where these characters showed up every time when using vi.
>>
>> So, the question has been raised, and I'm posting it to this group. Is there a simple method, in vim, of displaying ^M carriage return characters as a precaution or test when their presence in a file can be detrimental, if not catastrophic?
>
> Just set &fileformats option to unix. I.e. disable dos and mac file
> formats recognition (if *all* lines in a file end with CRLF then ^M in
> line endings will not be shown because file format (== file line
> ending format) is recognized as dos; just CR without LF is mac
> format). ^M is CR.

You need to do this *before* loading the file, e.g. in the vimrc. In
the running session reload file using `e ++ff=unix`.

>
>>
>> Thanks!!
>>
>> Neil
>>
>> --
>> --
>> 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.

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