Monday, October 4, 2010

Re: How to set utf-8 locally (for a buffer) on loading the file

On Mon, Oct 04, 2010 at 02:50:02AM -0700, esquifit wrote:
> [snip]
>
> relevant for GUI. Fundamentally I'm missing a high level description
> of which encodings and which conversions come at which moment into
> play (vim startup, loading from memory, input from user, writing to
> disk, internal representation, whatever)

:h mbyte.txt contains very detailed explanations what exactly
happens and when, but it's quite long.

If you use GVim, you only need to do two things to get it to
work. set encoding=utf-8 and set 'fileencodings' to a value of
your choice, depending which charsets you want to work with. I
use UTF-8 for most my work, but want to be able to read latin1,
so I use set fileencodings=utf-8,latin1.

Vimgor (the bot in #irssi) also has a short summary:

Vim has multiple settings for encodings: 'encoding' sets
Vim's internal encoding (should be utf-8), 'fileencoding'
sets the encoding of a file, 'fileencodings' (s) are
encodings tried when opening a file. If Vim doesn't detect
the encoding correctly, use :e ++enc=encoding filename to
force the given encoding. If possible try it in GVim or
terminal encoding problems might interfere.

If you use terminal Vim you also need to set 'termencoding' to
match the encoding your terminal uses. But I recommend GVim while
you're testing this.

> On a related note: is it possible to set different fonts in different
> vim windows/tabs within a single application window? (I could define
> an autocommand to restore the default font, but there is another
> situation in which this would not be a solution).

No idea, I only use terminal Vim.

Regards,
Simon
--
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

No comments: