On 15/04/10 16:34, Jean Johner wrote:
On Apr 15, 4:06 pm, Tony Mechelynck<[email protected]>
wrote:

But why install "special" unix2dos (and dos2unix) binaries when you
already have Vim?

Thank you, Tony, I am going to have a look.

At work, I use a unix server so that all my fortran code is in unix
format.
When I want to run a code locally on my NT PC, I use a .bat which
mixes some datafiles (in unix format) with the output of the code (in
dos format since I use the binary generated by the gfortran of the NT
PC). This is to have in the same listing the data and the results.

The mix is done using the cmd.exe command "copy listing+data listing".
It works but the resulting listing contains a mixture of records
endind with ^M^J and records ending with ^J. When you look at such a
file with vim, it is considered as a unix file and the dos parts
appear with these ugly ^M at the end.
That the reason why I translate my data files to dos format before
doing the above copy.

Best regards
Jean Johner



With recent versions of Vim, you can (as your previous post seems to imply you know) force Vim to treat either CR+LF or LF alone as a line break when reading, and to write CR+LF at the end of every line when reading, by opening the file with

        :e ++ff=dos listing

(the critical patch for this is 7.2.040). This will read the file as if it were a Dos file and add any missing ^M before a ^J -- if you don't forget to write it back.

Or you could also do the merge interactively in Vim (untested, but I believe it would work):

        :e listing
        :setl ff?
  fileformat=dos
        :$r data
        " maybe do some manual editing
        :wq



Best regards,
Tony.
--
All Finagle Laws may be bypassed by learning the simple art of doing
without thinking.

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to