Tuesday, May 24, 2011

Re: Character encoding in vim

On 24/05/11 22:51, Ven Tadipatri wrote:
> On Thu, May 19, 2011 at 7:44 AM, Ben Fritz<fritzophrenic@gmail.com> wrote:
>>
>>
>>
>> Since there are two bytes being displayed I'm going to guess you're
>> editing a UTF-8 encoded file with your encoding set to the default 8-
>> bit encoding for your system (probably latin1).
>
> I'm actually editing the output of running maven, so maybe it wrote it
> out in UTF-8 format.
>
>>
>> You will need to set at least two options to let this work correctly:
>>
>> 'encoding'
>> 'fileencodings'
>>
>
> When I type :set encoding? it says "option not supported". Maybe my
> version of Vim wasn't built with unicode support?

If you get that, the probable reason is indeed that you have no
miltibyte support.

> How do I check if I have multi-byte support? Is there some easy way to
> add it if it's not there, or do I have to rebuild vim?

:echo has('multi_byte')

zero means No, anything else (usually 1) means Yes

Also, in the output of ":version", you'll see -multi_byte if you don't
have it, +multi_byte or +multi_byte_ime or +multi_byte_ime/dyn if you do.

Now how to get a Vim executable with multibyte support? That depends on
your OS.

For Windows, browse to http://sourceforge.net/projects/cream/files/ and
get the latest installer under "Vim", it's a recent distribution with
console and GUI Vim, all runtime files updated to the date the installer
was built, and the corresponding "Release notes" are the output of the
:version command from the GUI, with a few additional blank lines for
legibility.

On most Linux distributions, there are several Vim packages that you can
install. How they are named depends on your distribution: for instance,
with my openSUSE Linux you should install the packages vim-base and
vim-data plus at least one of vim, vim-enhanced and gvim; a number of
optional plugins are also available. In general, if (like here) three
executables are provided, they are usually a "tiny" bare-bones version
with no expression evaluation and no syntax highlighting, a console
version with mostly everything except X11 support and GUI, and a
full-fledged GUI which can also work in Console mode.

You can also compile your own Vim, see
http://vim.wikia.com/wiki/Category:Building_Vim
http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm

On the Mac, I recommend the macvim distribution; see
http://vim.sourceforge.net/download.php#mac

>
> Thanks,
> Ven


HTH,
Tony.
--
Q: How many supply-siders does it take to change a light bulb?
A: None. The darkness will cause the light bulb to change by itself.

--
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

No comments: