Hi all,

Roland - thank you for the response.

Unfortunately, there is no simple solution to the problems that you described:
> (1)  viminfo files with register contents resulting from alternating 
>    fileencondings
> (2)  The patch file resulting from the diff between old and new files after 
>    a command similar to "iconv -f ISO-8859-1 -t utf-8 ..."

And it's not what I was trying to fix. Neither I was trying to fix gzip/bz2 
decompression - you are right, autocmd-based solutions are stable 
enough.

I was aiming at something different.
Problem (as I see it): Vim is based on a fact that every text file is
POSIX-compliant 
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
 
which is not necessarily true on all platforms supported by Vim.



Because of that, some scenarios are not currently supported by Vim.
For example:

Given: a text file in UTF-8 encoding, with BOM, with DOS line endings and 
       without trailing EOL.

Scenario: edit the contents of this file preserving all the attributes 
          specified in Given.

Real-world application: Microsoft Visual Studio project file in source control.

Solutions that Vim provides currently: 
 (1) regular :save - will add a trailing EOL;
 (2) :w ++binary - will replace <CR><LF>s with <LF>s and lose BOM;
 (3) Solution from vim.wikia - 
     http://vim.wikia.com/wiki/Preserve_missing_end-of-line_at_end_of_text_files
     - preserves <CR><LF>s, but loses BOM and adds some overhead to the
     write process;
 (4) vim -b <filename> - displays <CR>s and BOM as deletable characters and 
     disables some text-related options (like 'expandtab' and 'modeline'), so 
     it's not always applicable;
 (5) some more complicated solutions I found on the Internet use external 
     scripts (Python or Perl) to remove EOL from already saved file, 
     which seems like an overkill to me - why to write and then remove 
     something if we don't need it originally? Besides, Python and Perl are 
     not always available on all platforms.

Solution with my changes:
  :set reol
  :w

In my particular case, adding the following to the .vimrc:
  au BufWrite *.csproj set respecteol
will once and for all declare all *.csproj files as not necessarily 
POSIX-compliant.



I'm sorry if I confused anyone by my original message and I hope that my point 
is more clear now.

Thank you.

-- 
Best regards,
  Pavel

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui