Sunday, August 23, 2009

Re: annoying difference between vim and notepad

Excerpts from drlatex's message of Mon Aug 24 01:52:00 +0200 2009:
> So my question is, why does vim not have the \n at the end after pressing
> %j! , while matlab and notepad seem to thing there IS a \n at the end ?? And
> is there a way to modify the files with vim so that matlab and notepad don't
> add this \n to the end ??

:h binary and :h eol

To get no "\n" at the end of file (which is your end of line here)
:setlocal binary | setlocal noeol | w

If you want to do batch processing maybe readfile(..) and writefile(..)
in binary mode could do what you want as well.

So maybe this joins lines removing without adding a trailing "\n" as
well ? (untested)
:call writefile(join(readfile("file",1), "file.out","b"))

Even ifI 've missunderstood your goal this should help you solving your problem.

HTH
Marc W.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: