Saturday, May 2, 2015

Re: Vim renders garbled text with certain files, while other text editors have no problem.

On 2015-05-02 10:53, Bidit Mazumder wrote:
> I opened the attached file "com.apple.TextEdit.plist" using
> MacVim's factory settings: <mvim -u NONE -U NONE -N --cmd
> ':filetype plugin on' com.apple.TextEdit.plist>.
>
> MacVim rendered a bunch of garbled text (see vim.tiff). I tried the
> same process with Vim and Vi and the rendered text was garbled in
> the same fashion.
>
> However, when I opened the file with BBEdit, it was fine (see
> bbedit.tiff).
>
> Does anyone know why the text in the plist file is garbled when
> opened with Vi/Vim/MacVim; but renders perfectly with other text
> editors?

The actual .plist file is an opaque binary blob that Vim renders as
is. You can see these contents by piping them to a hex viewer:

xxd com.apple.TextEdit.plist

You may have to create a filter much like the gzip one at

:help gzip-example

which would use something like

plutil -convert xml1 -o - <afile>

to convert it into XML that you can edit, and then use

plutil -convert binary11 -o - <afile>

to restore it to the binary blob for future use.

(not having a Mac readily available, I'm shooting from the hip with
the exact syntax of those commands, but that info should at least put
you on the right road)

-tim





--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: