Home Explore Blog CI



neovim

1st chunk of `runtime/doc/mbyte.txt`
e689cb8976aaa1a734b0537a758cdd00d5e660d660eef7590000000100000fa0
*mbyte.txt*     Nvim


		  VIM REFERENCE MANUAL	  by Bram Moolenaar et al.


Multi-byte support				*multibyte* *multi-byte*
						*Chinese* *Japanese* *Korean*
This is about editing text in languages which have many characters that can
not be represented using one byte (one octet).  Examples are Chinese, Japanese
and Korean.  Unicode is also covered here.

For an introduction to the most common features, see |usr_45.txt| in the user
manual.
For changing the language of messages and menus see |mlang.txt|.

                                      Type |gO| to see the table of contents.

==============================================================================
Getting started						*mbyte-first*

This is a summary of the multibyte features in Nvim.


LOCALE

First of all, you must make sure your current locale is set correctly.  If
your system has been installed to use the language, it probably works right
away.  If not, you can often make it work by setting the $LANG environment
variable in your shell: >

	setenv LANG ja_JP.EUC

Unfortunately, the name of the locale depends on your system.  Japanese might
also be called "ja_JP.EUCjp" or just "ja".  To see what is currently used: >

	:language

To change the locale inside Vim use: >

	:language ja_JP.EUC

Vim will give an error message if this doesn't work.  This is a good way to
experiment and find the locale name you want to use.  But it's always better
to set the locale in the shell, so that it is used right from the start.

See |mbyte-locale| for details.


ENCODING

Nvim always uses UTF-8 internally. Thus 'encoding' is always set to "utf-8"
and cannot be changed.

All the text that is used inside Vim will be in UTF-8. Not only the text in
the buffers, but also in registers, variables, etc.

You can edit files in different encodings than UTF-8.  Nvim will convert the
file when you read it and convert it back when you write it.
See 'fileencoding', 'fileencodings' and |++enc|.


DISPLAY AND FONTS

If you are working in a terminal (emulator) you must make sure it accepts
UTF-8, the encoding which Vim is working with. Otherwise only ASCII can
be displayed and edited correctly.

For the GUI you must select fonts that work with UTF-8.  You can set 'guifont'
and 'guifontwide'.  'guifont' is used for the single-width characters,
'guifontwide' for the double-width characters. Thus the 'guifontwide' font
must be exactly twice as wide as 'guifont'. Example for UTF-8: >

	:set guifont=-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
	:set guifontwide=-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1

You can also set 'guifont' alone, the Nvim GUI will try to find a matching
'guifontwide' for you.


INPUT

There are several ways to enter multibyte characters:
- Your system IME can be used.
- Keymaps can be used.  See |mbyte-keymap|.

The options 'iminsert', 'imsearch' and 'imcmdline' can be used to choose
the different input methods or disable them temporarily.

==============================================================================
Locale							*mbyte-locale*

The easiest setup is when your whole system uses the locale you want to work
in.  But it's also possible to set the locale for one shell you are working
in, or just use a certain locale inside Vim.


WHAT IS A LOCALE?					*locale*

There are many languages in the world.  And there are different cultures and
environments at least as many as the number of languages.  A linguistic
environment corresponding to an area is called "locale".  This includes
information about the used language, the charset, collating order for sorting,
date format, currency format and so on.  For Vim only the language and charset
really matter.

You can only use a locale if your system has support for it.  Some systems
have only a few locales, especially in the USA.  The language which you want
to use may not be on your system.  In that case you might be able to install
it as an extra package.  Check your system documentation

Title: Multi-byte Support in Nvim
Summary
This section of the Vim reference manual discusses multi-byte support, focusing on editing text in languages with characters that cannot be represented using a single byte, such as Chinese, Japanese, and Korean, as well as Unicode. It covers setting the locale, encoding, display and fonts, and input methods for multibyte characters. The locale setting is crucial for the system to support the desired language and charset, while Nvim internally uses UTF-8 encoding.