asdasd asdasd wrote:
Hi,
I'm using Vi IMproved 7.0 (2006 May 7) on a Linux/i386
host.
I'm using vim to edit binary files. Every time I open
a binary file with a given extension, I use
autocommands to convert the binary file into a text
format (I enclose a copy of the .vimrc part affected).
Before writing the text file, the same autocommands
convert back the contents to the original binary
format.
I've been using this approach to edit gpg-encrypted
files, and am more than happy about it (see
http://www.vi-improved.org/wiki/index.php/VimGpg for
how to do this).

I'm running into problems with the endofline option
when writing my binaries. I'd like that whether
there's an EOL or not at the end of the written binary
file is decided by what the text-to-binary converter
produces on BufWritePre. Instead, it is a function of
what the original binary had.
For example, if the original binary file was "0\r\n",
the written binary file will have an '\n' char as last
char, independently of my editions, or what the
text-to-binary converter produces.

So far, I'm setting endofline by hand, but this is not
very nice.
I was wondering whether there's a way to request vim
to reconsider its endofline calculation while on a
BufWritePre.
Note: I'd appreciate if you could CC your answers to
pardillaco <at> yahoo.com.
Regards,
-pardillaco

Your script can use ":setlocal eol" or ":setlocal noeol" regardless of whether 'bin' is on at the time. What's your problem with that?


Best regards,
Tony.
--
"Rembrandt's first name was Beauregard, which is why he never used
it."
                -- Dave Barry

Reply via email to