Quantcast

Edit a Mac file with 0x13 CR newlines on Windows?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Edit a Mac file with 0x13 CR newlines on Windows?

Paul Watson
Is it possible on Windows to edit a old-style, pre-OS/X file from a Mac that uses 0x0D (CR) as the newline? If so, how?

Does this have something to do with 'set ffs='?

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Edit a Mac file with 0x13 CR newlines on Windows?

JohnBeckett
On Friday, March 24, 2017 at 2:34:05 PM UTC+11, Paul Watson wrote:
> Is it possible on Windows to edit a old-style, pre-OS/X file from a Mac that uses 0x0D (CR) as the newline? If so, how?
>
> Does this have something to do with 'set ffs='?

See
http://vim.wikia.com/wiki/File_format

If the file is open in Vim, entering the following reloads it using CR-only line endings.

:e ++ff=mac

John

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Edit a Mac file with 0x13 CR newlines on Windows?

Tony Mechelynck
In reply to this post by Paul Watson
On Thu, Mar 23, 2017 at 4:02 PM, Paul Watson <[hidden email]> wrote:
> Is it possible on Windows to edit a old-style, pre-OS/X file from a Mac that uses 0x0D (CR) as the newline? If so, how?
>
> Does this have something to do with 'set ffs='?

Yes. The 'fileformats' option specifies which fileformat(s) you want
Vim to recognize. It is a comma-separated list:

unix: each line ends with a single <NL>, 0x10
dos: each line ends with a <CR><NL> pair, 0x13 0x10 in that order.
mac: each line ends with only a <CR>, 0x13.

Depending on the option's value, Vim will try to determine the
'fileformat' used for the file and set that. Note that Windows
(dos-format) files lacking an end-of-line on their last line will
usually be detected as "unix" if 'fileformats' includes it, displaying
a ^M at the end of all other lines, and that when trying to read a
file as "dos" (either because the option does not include "unix" or
because you forced dos mode, see below) lines lacking a <CR> before
the <NL> will be silently accepted.

To force a certain fileformat, add e.g. ++ff=mac between the command
(:edit, :new, :vsplit, etc.) and the filename.

See:
    :help 'fileformats'
    :help 'fileformat'
    :help file-formats
    :help ++opt

Best regards,
Tony.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Edit a Mac file with 0x13 CR newlines on Windows?

Tony Mechelynck
OOps, I meant 0x0A or 10 decimal, not 0x10, and 0x0D or 13 decimal, not 0x13.

Tony.

On Fri, Mar 24, 2017 at 5:25 AM, Tony Mechelynck
<[hidden email]> wrote:

> On Thu, Mar 23, 2017 at 4:02 PM, Paul Watson <[hidden email]> wrote:
>> Is it possible on Windows to edit a old-style, pre-OS/X file from a Mac that uses 0x0D (CR) as the newline? If so, how?
>>
>> Does this have something to do with 'set ffs='?
>
> Yes. The 'fileformats' option specifies which fileformat(s) you want
> Vim to recognize. It is a comma-separated list:
>
> unix: each line ends with a single <NL>, 0x10
> dos: each line ends with a <CR><NL> pair, 0x13 0x10 in that order.
> mac: each line ends with only a <CR>, 0x13.
>
> Depending on the option's value, Vim will try to determine the
> 'fileformat' used for the file and set that. Note that Windows
> (dos-format) files lacking an end-of-line on their last line will
> usually be detected as "unix" if 'fileformats' includes it, displaying
> a ^M at the end of all other lines, and that when trying to read a
> file as "dos" (either because the option does not include "unix" or
> because you forced dos mode, see below) lines lacking a <CR> before
> the <NL> will be silently accepted.
>
> To force a certain fileformat, add e.g. ++ff=mac between the command
> (:edit, :new, :vsplit, etc.) and the filename.
>
> See:
>     :help 'fileformats'
>     :help 'fileformat'
>     :help file-formats
>     :help ++opt
>
> Best regards,
> Tony.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Edit a Mac file with 0x13 CR newlines on Windows?

Shawn H Corey
In reply to this post by JohnBeckett
On Thu, 23 Mar 2017 21:23:04 -0700 (PDT)
JohnBeckett <[hidden email]> wrote:

> On Friday, March 24, 2017 at 2:34:05 PM UTC+11, Paul Watson wrote:
> > Is it possible on Windows to edit a old-style, pre-OS/X file from a
> > Mac that uses 0x0D (CR) as the newline? If so, how?
> >
> > Does this have something to do with 'set ffs='?
>
> See
> http://vim.wikia.com/wiki/File_format
>
> If the file is open in Vim, entering the following reloads it using
> CR-only line endings.
>
> :e ++ff=mac
>
> John
>

You can also use Modeline Magic to set the file format in the file. See
http://vim.wikia.com/wiki/Modeline_magic


--
Don't stop where the ink does.

        Shawn H Corey

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Edit a Mac file with 0x13 CR newlines on Windows?

Watson, Paul
In reply to this post by Tony Mechelynck
-----Original Message-----

>> Is it possible on Windows to edit a old-style, pre-OS/X file from a Mac that uses 0x0D (CR) as the newline? If so, how?
>>
>> Does this have something to do with 'set ffs='?
>
>Yes. The 'fileformats' option specifies which fileformat(s) you want Vim to recognize. It is a comma-separated list: >
>
>unix: each line ends with a single <NL>, 0x10
>dos: each line ends with a <CR><NL> pair, 0x13 0x10 in that order.
>mac: each line ends with only a <CR>, 0x13.
>
>Depending on the option's value, Vim will try to determine the 'fileformat' used for the file and set that. Note that Windows
> (dos-format) files lacking an end-of-line on their last line will usually be detected as "unix" if 'fileformats' includes it, displaying a ^M at the end of all other lines, and that when trying to read a file as "dos" (either because the option does not include "unix" or because you forced dos >mode, see below) lines lacking a <CR> before the <NL> will be silently accepted.
>
>To force a certain fileformat, add e.g. ++ff=mac between the command (:edit, :new, :vsplit, etc.) and the filename.
>
>
>See:
>    :help 'fileformats'
>    :help 'fileformat'
>    :help file-formats
>    :help ++opt

Many thanks to Tony Mechelynck and John Beckett.

*-*-*- Presbyterian_Healthcare_Services_DISCLAIMER -*-*-*
This message originates from Presbyterian Healthcare Services or one of its affiliated organizations.
It contains information, which may be confidential or privileged, and is intended only for the individual or entity named above. It is prohibited for anyone else to disclose, copy, distribute or use the contents of this message. All personal messages express views solely of the sender, which are not to be attributed to Presbyterian Healthcare Services or any of its affiliated organizations, and may not be distributed without this disclaimer.

If you received this message in error, please notify us immediately at [hidden email]
If you would like more information about Presbyterian Healthcare Services please visit our web site http://www.phs.org

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...