blob: 7f6a972b0a335ed6a1b5f1a6c9f3b7bf4667852b [file] [log] [blame]
Bram Moolenaar35fdbb52005-07-09 21:08:57 +00001*mbyte.txt* For Vim version 7.0aa. Last change: 2005 Jul 09
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3
4 VIM REFERENCE MANUAL by Bram Moolenaar et al.
5
6
7Multi-byte support *multibyte* *multi-byte*
8 *Chinese* *Japanese* *Korean*
9This is about editing text in languages which have many characters that can
10not be represented using one byte (one octet). Examples are Chinese, Japanese
11and Korean. Unicode is also covered here.
12
13For an introduction to the most common features, see |usr_45.txt| in the user
14manual.
15For changing the language of messages and menus see |mlang.txt|.
16
17{not available when compiled without the +multi_byte feature}
18
19
201. Getting started |mbyte-first|
212. Locale |mbyte-locale|
223. Encoding |mbyte-encoding|
234. Using a terminal |mbyte-terminal|
245. Fonts on X11 |mbyte-fonts-X11|
256. Fonts on MS-Windows |mbyte-fonts-MSwin|
267. Input on X11 |mbyte-XIM|
278. Input on MS-Windows |mbyte-IME|
289. Input with a keymap |mbyte-keymap|
2910. Using UTF-8 |mbyte-utf8|
3011. Overview of options |mbyte-options|
31
32NOTE: This file contains UTF-8 characters. These may show up as strange
33characters or boxes when using another encoding.
34
35==============================================================================
361. Getting started *mbyte-first*
37
38This is a summary of the multibyte features in Vim. If you are lucky it works
39as described and you can start using Vim without much trouble. If something
40doesn't work you will have to read the rest. Don't be surprised if it takes
41quite a bit of work and experimenting to make Vim use all the multi-byte
42features. Unfortunately, every system has its own way to deal with multibyte
43languages and it is quite complicated.
44
45
46COMPILING
47
48If you already have a compiled Vim program, check if the |+multi_byte| feature
49is included. The |:version| command can be used for this.
50
51If +multi_byte is not included, you should compile Vim with "big" features.
52You can further tune what features are included. See the INSTALL files in the
53source directory.
54
55
56LOCALE
57
58First of all, you must make sure your current locale is set correctly. If
59your system has been installed to use the language, it probably works right
60away. If not, you can often make it work by setting the $LANG environment
61variable in your shell: >
62
63 setenv LANG ja_JP.EUC
64
65Unfortunately, the name of the locale depends on your system. Japanese might
66also be called "ja_JP.EUCjp" or just "ja". To see what is currently used: >
67
68 :language
69
70To change the locale inside Vim use: >
71
72 :language ja_JP.EUC
73
74Vim will give an error message if this doesn't work. This is a good way to
75experiment and find the locale name you want to use. But it's always better
76to set the locale in the shell, so that it is used right from the start.
77
78See |mbyte-locale| for details.
79
80
81ENCODING
82
83If your locale works properly, Vim will try to set the 'encoding' option
84accordingly. If this doesn't work you can overrule its value: >
85
86 :set encoding=utf-8
87
88See |encoding-values| for a list of acceptable values.
89
90The result is that all the text that is used inside Vim will be in this
91encoding. Not only the text in the buffers, but also in registers, variables,
92etc. This also means that changing the value of 'encoding' makes the existing
93text invalid! The text doesn't change, but it will be displayed wrong.
94
95You can edit files in another encoding than what 'encoding' is set to. Vim
96will convert the file when you read it and convert it back when you write it.
97See 'fileencoding', 'fileencodings' and |++enc|.
98
99
100DISPLAY AND FONTS
101
102If you are working in a terminal (emulator) you must make sure it accepts the
103same encoding as which Vim is working with. If this is not the case, you can
104use the 'termencoding' option to make Vim convert text automatically.
105
106For the GUI you must select fonts that work with the current 'encoding'. This
107is the difficult part. It depends on the system you are using, the locale and
108a few other things. See the chapters on fonts: |mbyte-fonts-X11| for
109X-Windows and |mbyte-fonts-MSwin| for MS-Windows.
110
111For GTK+ 2, you can skip most of this section. The option 'guifontset' does
112no longer exist. You only need to set 'guifont' and everything should "just
113work". If your system comes with Xft2 and fontconfig and the current font
114does not contain a certain glyph, a different font will be used automatically
115if available. The 'guifontwide' option is still supported but usually you do
116not need to set it. It is only necessary if the automatic font selection does
117not suit your needs.
118
119For X11 you can set the 'guifontset' option to a list of fonts that together
120cover the characters that are used. Example for Korean: >
121
122 :set guifontset=k12,r12
123
124Alternatively, you can set 'guifont' and 'guifontwide'. 'guifont' is used for
125the single-width characters, 'guifontwide' for the double-width characters.
126Thus the 'guifontwide' font must be exactly twice as wide as 'guifont'.
127Example for UTF-8: >
128
129 :set guifont=-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
130 :set guifontwide=-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1
131
132You can also set 'guifont' alone, Vim will try to find a matching
133'guifontwide' for you.
134
135
136INPUT
137
138There are several ways to enter multi-byte characters:
139- For X11 XIM can be used. See |XIM|.
140- For MS-Windows IME can be used. See |IME|.
141- For all systems keymaps can be used. See |mbyte-keymap|.
142
143The options 'iminsert', 'imsearch' and 'imcmdline' can be used to chose
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000144the different input methods or disable them temporarily.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000145
146==============================================================================
1472. Locale *mbyte-locale*
148
149The easiest setup is when your whole system uses the locale you want to work
150in. But it's also possible to set the locale for one shell you are working
151in, or just use a certain locale inside Vim.
152
153
154WHAT IS A LOCALE? *locale*
155
156There are many of languages in the world. And there are different cultures
157and environments at least as much as the number of languages. A linguistic
158environment corresponding to an area is called "locale". This includes
159information about the used language, the charset, collating order for sorting,
160date format, currency format and so on. For Vim only the language and charset
161really matter.
162
163You can only use a locale if your system has support for it. Some systems
164have only a few locales, especially in the USA. The language which you want
165to use may not be on your system. In that case you might be able to install
166it as an extra package. Check your system documentation for how to do that.
167
168The location in which the locales are installed varies from system to system.
169For example, "/usr/share/locale" or "/usr/lib/locale". See your system's
170setlocale() man page.
171
172Looking in these directories will show you the exact name of each locale.
173Mostly upper/lowercase matters, thus "ja_JP.EUC" and "ja_jp.euc" are
174different. Some systems have a locale.alias file, which allows translation
175from a short name like "nl" to the full name "nl_NL.ISO_8859-1".
176
177Note that X-windows has its own locale stuff. And unfortunately uses locale
178names different from what is used elsewhere. This is confusing! For Vim it
179matters what the setlocale() function uses, which is generally NOT the
180X-windows stuff. You might have to do some experiments to find out what
181really works.
182
183 *locale-name*
184The (simplified) format of |locale| name is:
185
186 language
187or language_territory
188or language_territory.codeset
189
190Territory means the country (or part of it), codeset means the |charset|. For
191example, the locale name "ja_JP.eucJP" means:
192 ja the language is Japanese
193 JP the country is Japan
194 eucJP the codeset is EUC-JP
195But it also could be "ja", "ja_JP.EUC", "ja_JP.ujis", etc. And unfortunately,
196the locale name for a specific language, territory and codeset is not unified
197and depends on your system.
198
199Examples of locale name:
200 charset language locale name ~
201 GB2312 Chinese (simplified) zh_CN.EUC, zh_CN.GB2312
202 Big5 Chinese (traditional) zh_TW.BIG5, zh_TW.Big5
203 CNS-11643 Chinese (traditional) zh_TW
204 EUC-JP Japanese ja, ja_JP.EUC, ja_JP.ujis, ja_JP.eucJP
205 Shift_JIS Japanese ja_JP.SJIS, ja_JP.Shift_JIS
206 EUC-KR Korean ko, ko_KR.EUC
207
208
209USING A LOCALE
210
211To start using a locale for the whole system, see the documentation of your
212system. Mostly you need to set it in a configuration file in "/etc".
213
214To use a locale in a shell, set the $LANG environment value. When you want to
215use Korean and the |locale| name is "ko", do this:
216
217 sh: export LANG=ko
218 csh: setenv LANG ko
219
220You can put this in your ~/.profile or ~/.cshrc file to always use it.
221
222To use a locale in Vim only, use the |:language| command: >
223
224 :language ko
225
226Put this in your ~/.vimrc file to use it always.
227
228Or specify $LANG when starting Vim:
229
230 sh: LANG=ko vim {vim-arguments}
231 csh: env LANG=ko vim {vim-arguments}
232
233You could make a small shell script for this.
234
235==============================================================================
2363. Encoding *mbyte-encoding*
237
238Vim uses the 'encoding' option to specify how characters identified and
239encoded when they are used inside Vim. This applies to all the places where
240text is used, including buffers (files loaded into memory), registers and
241variables.
242
243 *charset* *codeset*
244Charset is another name for encoding. There are subtle differences, but these
245don't matter when using Vim. "codeset" is another similar name.
246
247Each character is encoded as one or more bytes. When all characters are
248encoded with one byte, we call this a single-byte encoding. The most often
249used one is called "latin1". This limits the number of characters to 256.
250Some of these are control characters, thus even fewer can be used for text.
251
252When some characters use two or more bytes, we call this a multi-byte
253encoding. This allows using much more than 256 characters, which is required
254for most East Asian languages.
255
256Most multi-byte encodings use one byte for the first 127 characters. These
257are equal to ASCII, which makes it easy to exchange plain-ASCII text, no
258matter what language is used. Thus you might see the right text even when the
259encoding was set wrong.
260
261 *encoding-names*
262Vim can use many different character encodings. There are three major groups:
263
2641 8bit Single-byte encodings, 256 different characters. Mostly used
265 in USA and Europe. Example: ISO-8859-1 (Latin1). All
266 characters occupy one screen cell only.
267
2682 2byte Double-byte encodings, over 10000 different characters.
269 Mostly used in Asian countries. Example: euc-kr (Korean)
270 The number of screen cells is equal to the number of bytes
271 (except for euc-jp when the first byte is 0x8e).
272
273u Unicode Universal encoding, can replace all others. ISO 10646.
274 Millions of different characters. Example: UTF-8. The
275 relation between bytes and screen cells is complex.
276
277Other encodings cannot be used by Vim internally. But files in other
278encodings can be edited by using conversion, see 'fileencoding'.
279Note that all encodings must use ASCII for the characters up to 128 (except
280when compiled for EBCDIC).
281
282Supported 'encoding' values are: *encoding-values*
2831 latin1 8-bit characters (ISO 8859-1)
2841 iso-8859-n ISO_8859 variant (n = 2 to 15)
2851 koi8-r Russian
2861 koi8-u Ukrainian
2871 macroman MacRoman (Macintosh encoding)
2881 8bit-{name} any 8-bit encoding (Vim specific name)
Bram Moolenaar35fdbb52005-07-09 21:08:57 +00002891 cp437 similar to iso-8859-1
2901 cp737 similar to iso-8859-7
2911 cp775 Baltic
2921 cp850 similar to iso-8859-4
2931 cp852 similar to iso-8859-1
2941 cp855 similar to iso-8859-2
2951 cp857 similar to iso-8859-5
2961 cp860 similar to iso-8859-9
2971 cp861 similar to iso-8859-1
2981 cp862 similar to iso-8859-1
2991 cp863 similar to iso-8859-8
3001 cp865 similar to iso-8859-1
3011 cp866 similar to iso-8859-5
3021 cp869 similar to iso-8859-7
3031 cp874 Thai
3041 cp1250 Czech, Polish, etc.
3051 cp1251 Cyrillic
3061 cp1253 Greek
3071 cp1254 Turkish
3081 cp1255 Hebrew
3091 cp1256 Arabic
3101 cp1257 Baltic
3111 cp1258 Vietnamese
Bram Moolenaar071d4272004-06-13 20:20:40 +00003121 cp{number} MS-Windows: any installed single-byte codepage
3132 cp932 Japanese (Windows only)
3142 euc-jp Japanese (Unix only)
3152 sjis Japanese (Unix only)
3162 cp949 Korean (Unix and Windows)
3172 euc-kr Korean (Unix only)
3182 cp936 simplified Chinese (Windows only)
3192 euc-cn simplified Chinese (Unix only)
3202 cp950 traditional Chinese (on Unix alias for big5)
3212 big5 traditional Chinese (on Windows alias for cp950)
3222 euc-tw traditional Chinese (Unix only)
3232 2byte-{name} Unix: any double-byte encoding (Vim specific name)
3242 cp{number} MS-Windows: any installed double-byte codepage
325u utf-8 32 bit UTF-8 encoded Unicode (ISO/IEC 10646-1)
326u ucs-2 16 bit UCS-2 encoded Unicode (ISO/IEC 10646-1)
327u ucs-2le like ucs-2, little endian
328u utf-16 ucs-2 extended with double-words for more characters
329u utf-16le like utf-16, little endian
330u ucs-4 32 bit UCS-4 encoded Unicode (ISO/IEC 10646-1)
331u ucs-4le like ucs-4, little endian
332
333The {name} can be any encoding name that your system supports. It is passed
334to iconv() to convert between the encoding of the file and the current locale.
335For MS-Windows "cp{number}" means using codepage {number}.
336Examples: >
337 :set encoding=8bit-cp1252
338 :set encoding=2byte-cp932
339<
340Several aliases can be used, they are translated to one of the names above.
341An incomplete list:
342
3431 ansi same as latin1 (obsolete, for backward compatibility)
3442 japan Japanese: on Unix "euc-jp", on MS-Windows cp932
3452 korea Korean: on Unix "euc-kr", on MS-Windows cp949
3462 prc simplified Chinese: on Unix "euc-cn", on MS-Windows cp936
3472 chinese same as "prc"
3482 taiwan traditional Chinese: on Unix "euc-tw", on MS-Windows cp950
349u utf8 same as utf-8
350u unicode same as ucs-2
351u ucs2be same as ucs-2 (big endian)
352u ucs-2be same as ucs-2 (big endian)
353u ucs-4be same as ucs-4 (big endian)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000354 default stands for the default value of 'encoding', depends on the
355 environment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000356
357For the UCS codes the byte order matters. This is tricky, use UTF-8 whenever
358you can. The default is to use big-endian (most significant byte comes
359first):
360 name bytes char ~
361 ucs-2 11 22 1122
362 ucs-2le 22 11 1122
363 ucs-4 11 22 33 44 11223344
364 ucs-4le 44 33 22 11 11223344
365
366On MS-Windows systems you often want to use "ucs-2le", because it uses little
367endian UCS-2.
368
369There are a few encodings which are similar, but not exactly the same. Vim
370treats them as if they were different encodings, so that conversion will be
371done when needed. You might want to use the similar name to avoid conversion
372or when conversion is not possible:
373
374 cp932, shift-jis, sjis
375 cp936, euc-cn
376
377 *encoding-table*
378Normally 'encoding' is equal to your current locale and 'termencoding' is
379empty. This means that your keyboard and display work with characters encoded
380in your current locale, and Vim uses the same characters internally.
381
382You can make Vim use characters in a different encoding by setting the
383'encoding' option to a different value. Since the keyboard and display still
384use the current locale, conversion needs to be done. The 'termencoding' then
385takes over the value of the current locale, so Vim converts between 'encoding'
386and 'termencoding'. Example: >
387 :let &termencoding = &encoding
388 :set encoding=utf-8
389
390However, not all combinations of values are possible. The table below tells
391you how each of the nine combinations works. This is further restricted by
392not all conversions being possible, iconv() being present, etc. Since this
393depends on the system used, no detailed list can be given.
394
395('tenc' is the short name for 'termencoding' and 'enc' short for 'encoding')
396
397'tenc' 'enc' remark ~
398
399 8bit 8bit Works. When 'termencoding' is different from
400 'encoding' typing and displaying may be wrong for some
401 characters, Vim does NOT perform conversion (set
402 'encoding' to "utf-8" to get this).
403 8bit 2byte MS-Windows: works for all codepages installed on your
404 system; you can only type 8bit characters;
405 Other systems: does NOT work.
406 8bit Unicode Works, but you can only type 8bit characters; in a
407 terminal you can only see 8bit characters; the GUI can
408 show all characters that the 'guifont' supports.
409
410 2byte 8bit Works, but typing non-ASCII characters might
411 be a problem.
412 2byte 2byte MS-Windows: works for all codepages installed on your
413 system; typing characters might be a problem when
414 locale is different from 'encoding'.
415 Other systems: Only works when 'termencoding' is equal
416 to 'encoding', you might as well leave it empty.
417 2byte Unicode works, Vim will translate typed characters.
418
419 Unicode 8bit works (unusual)
420 Unicode 2byte does NOT work
421 Unicode Unicode works very well (leaving 'termencoding' empty works
422 the same way, because all Unicode is handled
423 internally as UTF-8)
424
425CONVERSION *charset-conversion*
426
427Vim will automatically convert from one to another encoding in several places:
428- When reading a file and 'fileencoding' is different from 'encoding'
429- When writing a file and 'fileencoding' is different from 'encoding'
430- When displaying characters and 'termencoding' is different from 'encoding'
431- When reading input and 'termencoding' is different from 'encoding'
432- When displaying messages and the encoding used for LC_MESSAGES differs from
433 'encoding' (requires a gettext version that supports this).
434- When reading a Vim script where |:scriptencoding| is different from
435 'encoding'.
436- When reading or writing a |viminfo| file.
437Most of these require the |+iconv| feature. Conversion for reading and
438writing files may also be specified with the 'charconvert' option.
439
440Useful utilities for converting the charset:
441 All: iconv
442 GNU iconv can convert most encodings. Unicode is used as the
443 intermediate encoding, which allows conversion from and to all other
444 encodings. See http://www.gnu.org/directory/libiconv.html.
445
446 Japanese: nkf
447 Nkf is "Network Kanji code conversion Filter". One of the most unique
448 facility of nkf is the guess of the input Kanji code. So, you don't
449 need to know what the inputting file's |charset| is. When convert to
450 EUC-JP from ISO-2022-JP or Shift_JIS, simply do the following command
451 in Vim:
452 :%!nkf -e
453 Nkf can be found at:
454 http://www.sfc.wide.ad.jp/~max/FreeBSD/ports/distfiles/nkf-1.62.tar.gz
455
456 Chinese: hc
457 Hc is "Hanzi Converter". Hc convert a GB file to a Big5 file, or Big5
458 file to GB file. Hc can be found at:
459 ftp://ftp.cuhk.hk/pub/chinese/ifcss/software/unix/convert/hc-30.tar.gz
460
461 Korean: hmconv
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000462 Hmconv is Korean code conversion utility especially for E-mail. It can
Bram Moolenaar071d4272004-06-13 20:20:40 +0000463 convert between EUC-KR and ISO-2022-KR. Hmconv can be found at:
464 ftp://ftp.kaist.ac.kr/pub/hangul/code/hmconv/
465
466 Multilingual: lv
467 Lv is a Powerful Multilingual File Viewer. And it can be worked as
468 |charset| converter. Supported |charset|: ISO-2022-CN, ISO-2022-JP,
469 ISO-2022-KR, EUC-CN, EUC-JP, EUC-KR, EUC-TW, UTF-7, UTF-8, ISO-8859
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000470 series, Shift_JIS, Big5 and HZ. Lv can be found at:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000471 http://www.ff.iij4u.or.jp/~nrt/freeware/lv4495.tar.gz
472
473
474 *mbyte-conversion*
475When reading and writing files in an encoding different from 'encoding',
476conversion needs to be done. These conversions are supported:
477- All conversions between Latin-1 (ISO-8859-1), UTF-8, UCS-2 and UCS-4 are
478 handled internally.
479- For MS-Windows, when 'encoding' is a Unicode encoding, conversion from and
480 to any codepage should work.
481- Conversion specified with 'charconvert'
482- Conversion with the iconv library, if it is available.
483 Old versions of GNU iconv() may cause the conversion to fail (they
484 request a very large buffer, more than Vim is willing to provide).
485 Try getting another iconv() implementation.
486
487==============================================================================
4884. Using a terminal *mbyte-terminal*
489
490The GUI fully supports multi-byte characters. It is also possible in a
491terminal, if the terminal supports the same encoding that Vim uses. Thus this
492is less flexible.
493
494For example, you can run Vim in a xterm with added multi-byte support and/or
495|XIM|. Examples are kterm (Kanji term) and hanterm (for Korean), Eterm
496(Enlightened terminal) and rxvt.
497
498If your terminal does not support the right encoding, you can set the
499'termencoding' option. Vim will then convert the typed characters from
500'termencoding' to 'encoding'. And displayed text will be converted from
501'encoding' to 'termencoding'. If the encoding supported by the terminal
502doesn't include all the characters that Vim uses, this leads to lost
503characters. This may mess up the display. If you use a terminal that
504supports Unicode, such as the xterm mentioned below, it should work just fine,
505since nearly every character set can be converted to Unicode without loss of
506information.
507
508
509UTF-8 IN XFREE86 XTERM *UTF8-xterm*
510
511This is a short explanation of how to use UTF-8 character encoding in the
512xterm that comes with XFree86 by Thomas Dickey (text by Markus Kuhn).
513
514Get the latest xterm version which has now UTF-8 support:
515
516 http://invisible-island.net/xterm/xterm.html
517
518Compile it with "./configure --enable-wide-chars ; make"
519
520Also get the ISO 10646-1 version of various fonts, which is available on
521
522 http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz
523
524and install the font as described in the README file.
525
526Now start xterm with >
527
528 xterm -u8 -fn -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
529or, for bigger character: >
530 xterm -u8 -fn -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1
531
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000532and you will have a working UTF-8 terminal emulator. Try both >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000533
534 cat utf-8-demo.txt
535 vim utf-8-demo.txt
536
537with the demo text that comes with ucs-fonts.tar.gz in order to see
538whether there are any problems with UTF-8 in your xterm.
539
540For Vim you may need to set 'encoding' to "utf-8".
541
542==============================================================================
5435. Fonts on X11 *mbyte-fonts-X11*
544
545Unfortunately, using fonts in X11 is complicated. The name of a single-byte
546font is a long string. For multi-byte fonts we need several of these...
547
548Note: Most of this is no longer relevant for GTK+ 2. Selecting a font via
549its XLFD is not supported anymore; see 'guifont' for an example of how to
550set the font. Do yourself a favor and ignore the |XLFD| and |xfontset|
551sections below.
552
553First of all, Vim only accepts fixed-width fonts for displaying text. You
554cannot use proportionally spaced fonts. This excludes many of the available
555(and nicer looking) fonts. However, for menus and tooltips any font can be
556used.
557
558Note that Display and Input are independent. It is possible to see your
559language even though you have no input method for it.
560
561You should get a default font for menus and tooltips that works, but it might
562be ugly. Read the following to find out how to select a better font.
563
564
565X LOGICAL FONT DESCRIPTION (XLFD)
566 *XLFD*
567XLFD is the X font name and contains the information about the font size,
568charset, etc. The name is in this format:
569
570FOUNDRY-FAMILY-WEIGHT-SLANT-WIDTH-STYLE-PIXEL-POINT-X-Y-SPACE-AVE-CR-CE
571
572Each field means:
573
574- FOUNDRY: FOUNDRY field. The company that created the font.
575- FAMILY: FAMILY_NAME field. Basic font family name. (helvetica, gothic,
576 times, etc)
577- WEIGHT: WEIGHT_NAME field. How thick the letters are. (light, medium,
578 bold, etc)
579- SLANT: SLANT field.
580 r: Roman (no slant)
581 i: Italic
582 o: Oblique
583 ri: Reverse Italic
584 ro: Reverse Oblique
585 ot: Other
586 number: Scaled font
587- WIDTH: SETWIDTH_NAME field. Width of characters. (normal, condensed,
588 narrow, double wide)
589- STYLE: ADD_STYLE_NAME field. Extra info to describe font. (Serif, Sans
590 Serif, Informal, Decorated, etc)
591- PIXEL: PIXEL_SIZE field. Height, in pixels, of characters.
592- POINT: POINT_SIZE field. Ten times height of characters in points.
593- X: RESOLUTION_X field. X resolution (dots per inch).
594- Y: RESOLUTION_Y field. Y resolution (dots per inch).
595- SPACE: SPACING field.
596 p: Proportional
597 m: Monospaced
598 c: CharCell
599- AVE: AVERAGE_WIDTH field. Ten times average width in pixels.
600- CR: CHARSET_REGISTRY field. The name of the charset group.
601- CE: CHARSET_ENCODING field. The rest of the charset name. For some
602 charsets, such as JIS X 0208, if this field is 0, code points has
603 the same value as GL, and GR if 1.
604
605For example, in case of a 14 dots font corresponding to JIS X 0208, it is
606written like:
607 -misc-fixed-medium-r-normal--16-110-100-100-c-160-jisx0208.1990-0
608
609
610X FONTSET
611 *fontset* *xfontset*
612A single-byte charset is typically associated with one font. For multi-byte
613charsets a combination of fonts is often used. This means that one group of
614characters are used from one font and another group from another font (which
615might be double wide). This collection of fonts is called a fontset.
616
617Which fonts are required in a fontset depends on the current locale. X
618windows maintains a table of which groups of characters are required for a
619locale. You have to specify all the fonts that a locale requires in the
620'guifontset' option.
621
622NOTE: The fontset always uses the current locale, even though 'encoding' may
623be set to use a different charset. In that situation you might want to use
624'guifont' and 'guifontwide' instead of 'guifontset'.
625
626Example:
627 |charset| language "groups of characters" ~
628 GB2312 Chinese (simplified) ISO-8859-1 and GB 2312
629 Big5 Chinese (traditional) ISO-8859-1 and Big5
630 CNS-11643 Chinese (traditional) ISO-8859-1, CNS 11643-1 and CNS 11643-2
631 EUC-JP Japanese JIS X 0201 and JIS X 0208
632 EUC-KR Korean ISO-8859-1 and KS C 5601 (KS X 1001)
633
634You can search for fonts using the xlsfonts command. For example, when you're
635searching for a font for KS C 5601: >
636 xlsfonts | grep ksc5601
637
638This is complicated and confusing. You might want to consult the X-Windows
639documentation if there is something you don't understand.
640
641 *base_font_name_list*
642When you have found the names of the fonts you want to use, you need to set
643the 'guifontset' option. You specify the list by concatenating the font names
644and putting a comma in between them.
645
646For example, when you use the ja_JP.eucJP locale, this requires JIS X 0201
647and JIS X 0208. You could supply a list of fonts that explicitly specifies
648the charsets, like: >
649
650 :set guifontset=-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0,
651 \-misc-fixed-medium-r-normal--14-130-75-75-c-70-jisx0201.1976-0
652
653Alternatively, you can supply a base font name list that omits the charset
654name, letting X-Windows select font characters required for the locale. For
655example: >
656
657 :set guifontset=-misc-fixed-medium-r-normal--14-130-75-75-c-140,
658 \-misc-fixed-medium-r-normal--14-130-75-75-c-70
659
660Alternatively, you can supply a single base font name that allows X-Windows to
661select from all available fonts. For example: >
662
663 :set guifontset=-misc-fixed-medium-r-normal--14-*
664
665Alternatively, you can specify alias names. See the fonts.alias file in the
666fonts directory (e.g., /usr/X11R6/lib/X11/fonts/). For example: >
667
668 :set guifontset=k14,r14
669<
670 *E253*
671Note that in East Asian fonts, the standard character cell is square. When
672mixing a Latin font and an East Asian font, the East Asian font width should
673be twice the Latin font width.
674
675If 'guifontset' is not empty, the "font" argument of the |:highlight| command
676is also interpreted as a fontset. For example, you should use for
677highlighting: >
678 :hi Comment font=english_font,your_font
679If you use a wrong "font" argument you will get an error message.
680Also make sure that you set 'guifontset' before setting fonts for highlight
681groups.
682
683
684USING RESOURCE FILES
685
686Instead of specifying 'guifontset', you can set X11 resources and Vim will
687pick them up. This is only for people who know how X resource files work.
688
689For Motif and Athena insert these three lines in your $HOME/.Xdefaults file:
690
691 Vim.font: |base_font_name_list|
692 Vim*fontSet: |base_font_name_list|
693 Vim*fontList: your_language_font
694
695Note: Vim.font is for text area.
696 Vim*fontSet is for menu.
697 Vim*fontList is for menu (for Motif GUI)
698
699For example, when you are using Japanese and a 14 dots font, >
700
701 Vim.font: -misc-fixed-medium-r-normal--14-*
702 Vim*fontSet: -misc-fixed-medium-r-normal--14-*
703 Vim*fontList: -misc-fixed-medium-r-normal--14-*
704<
705or: >
706
707 Vim*font: k14,r14
708 Vim*fontSet: k14,r14
709 Vim*fontList: k14,r14
710<
711To have them take effect immediately you will have to do >
712
713 xrdb -merge ~/.Xdefaults
714
715Otherwise you will have to stop and restart the X server before the changes
716take effect.
717
718
719The GTK+ version of GUI Vim does not use .Xdefaults, use ~/.gtkrc instead.
720The default mostly works OK. But for the menus you might have to change
721it. Example: >
722
723 style "default"
724 {
725 fontset="-*-*-medium-r-normal--14-*-*-*-c-*-*-*"
726 }
727 widget_class "*" style "default"
728
729==============================================================================
7306. Fonts on MS-Windows *mbyte-fonts-MSwin*
731
732The simplest is to use the font dialog to select fonts and try them out. You
733can find this at the "Edit/Select Font..." menu. Once you find a font name
734that works well you can use this command to see its name: >
735
736 :set guifont
737
738Then add a command to your |gvimrc| file to set 'guifont': >
739
740 :set guifont=courier_new:h12
741
742==============================================================================
7437. Input on X11 *mbyte-XIM*
744
745X INPUT METHOD (XIM) BACKGROUND *XIM* *xim* *x-input-method*
746
747XIM is an international input module for X. There are two kind of structures,
748Xlib unit type and |IM-server| (Input-Method server) type. |IM-server| type
749is suitable for complex input, such as CJK.
750
751- IM-server
752 *IM-server*
753 In |IM-server| type input structures, the input event is handled by either
754 of the two ways: FrontEnd system and BackEnd system. In the FrontEnd
755 system, input events are snatched by the |IM-server| first, then |IM-server|
756 give the application the result of input. On the other hand, the BackEnd
757 system works reverse order. MS Windows adopt BackEnd system. In X, most of
758 |IM-server|s adopt FrontEnd system. The demerit of BackEnd system is the
759 large overhead in communication, but it provides safe synchronization with
760 no restrictions on applications.
761
762 For example, there are xwnmo and kinput2 Japanese |IM-server|, both are
763 FrontEnd system. Xwnmo is distributed with Wnn (see below), kinput2 can be
764 found at: ftp://ftp.sra.co.jp/pub/x11/kinput2/
765
766 For Chinese, there's a great XIM server named "xcin", you can input both
767 Traditional and Simplified Chinese characters. And it can accept other
768 locale if you make a correct input table. Xcin can be found at:
769 http://xcin.linux.org.tw/
Bram Moolenaar8299df92004-07-10 09:47:34 +0000770 Others are scim: http://scim.freedesktop.org/ and fcitx:
771 http://www.fcitx.org/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000772
773- Conversion Server
774 *conversion-server*
775 Some system needs additional server: conversion server. Most of Japanese
776 |IM-server|s need it, Kana-Kanji conversion server. For Chinese inputting,
777 it depends on the method of inputting, in some methods, PinYin or ZhuYin to
778 HanZi conversion server is needed. For Korean inputting, if you want to
779 input Hanja, Hangul-Hanja conversion server is needed.
780
781 For example, the Japanese inputting process is divided into 2 steps. First
782 we pre-input Hira-gana, second Kana-Kanji conversion. There are so many
783 Kanji characters (6349 Kanji characters are defined in JIS X 0208) and the
784 number of Hira-gana characters are 76. So, first, we pre-input text as
785 pronounced in Hira-gana, second, we convert Hira-gana to Kanji or Kata-Kana,
786 if needed. There are some Kana-Kanji conversion server: jserver
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000787 (distributed with Wnn, see below) and canna. Canna could be found at:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000788 ftp://ftp.nec.co.jp/pub/Canna/ (no longer works).
789
790There is a good input system: Wnn4.2. Wnn 4.2 contains,
791 xwnmo (|IM-server|)
792 jserver (Japanese Kana-Kanji conversion server)
793 cserver (Chinese PinYin or ZhuYin to simplified HanZi conversion server)
794 tserver (Chinese PinYin or ZhuYin to traditional HanZi conversion server)
795 kserver (Hangul-Hanja conversion server)
796Wnn 4.2 for several systems can be found at various places on the internet.
797Use the RPM or port for your system.
798
799
800- Input Style
801 *xim-input-style*
802 When inputting CJK, there are four areas:
803 1. The area to display of the input while it is being composed
804 2. The area to display the currently active input mode.
805 3. The area to display the next candidate for the selection.
806 4. The area to display other tools.
807
808 The third area is needed when converting. For example, in Japanese
809 inputting, multiple Kanji characters could have the same pronunciation, so
810 a sequence of Hira-gana characters could map to a distinct sequence of Kanji
811 characters.
812
813 The first and second areas are defined in international input of X with the
814 names of "Preedit Area", "Status Area" respectively. The third and fourth
815 areas are not defined and are left to be managed by the |IM-server|. In the
816 international input, four input styles have been defined using combinations
817 of Preedit Area and Status Area: |OnTheSpot|, |OffTheSpot|, |OverTheSpot|
818 and |Root|.
819
820 Currently, GUI Vim support three style, |OverTheSpot|, |OffTheSpot| and
821 |Root|.
822
823*. on-the-spot *OnTheSpot*
824 Preedit Area and Status Area are performed by the client application in
825 the area of application. The client application is directed by the
826 |IM-server| to display all pre-edit data at the location of text
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000827 insertion. The client registers callbacks invoked by the input method
Bram Moolenaar071d4272004-06-13 20:20:40 +0000828 during pre-editing.
829*. over-the-spot *OverTheSpot*
830 Status Area is created in a fixed position within the area of application,
831 in case of Vim, the position is the additional status line. Preedit Area
832 is made at present input position of application. The input method
833 displays pre-edit data in a window which it brings up directly over the
834 text insertion position.
835*. off-the-spot *OffTheSpot*
836 Preedit Area and Status Area are performed in the area of application, in
837 case of Vim, the area is additional status line. The client application
838 provides display windows for the pre-edit data to the input method which
839 displays into them directly.
840*. root-window *Root*
841 Preedit Area and Status Area are outside of the application. The input
842 method displays all pre-edit data in a separate area of the screen in a
843 window specific to the input method.
844
845
846USING XIM *multibyte-input* *E284* *E286* *E287* *E288*
847 *E285* *E291* *E292* *E290* *E289*
848
849Note that Display and Input are independent. It is possible to see your
850language even though you have no input method for it. But when your Display
851method doesn't match your Input method, the text will be displayed wrong.
852
853 Note: You can not use IM unless you specify 'guifontset'.
854 Therefore, Latin users, you have to also use 'guifontset'
855 if you use IM.
856
857To input your language you should run the |IM-server| which supports your
858language and |conversion-server| if needed.
859
860The next 3 lines should be put in your ~/.Xdefaults file. They are common for
861all X applications which uses |XIM|. If you already use |XIM|, you can skip
862this. >
863
864 *international: True
865 *.inputMethod: your_input_server_name
866 *.preeditType: your_input_style
867<
868input_server_name is your |IM-server| name (check your |IM-server|
869 manual).
870your_input_style is one of |OverTheSpot|, |OffTheSpot|, |Root|. See
871 also |xim-input-style|.
872
873*international may not necessary if you use X11R6.
874*.inputMethod and *.preeditType are optional if you use X11R6.
875
876For example, when you are using kinput2 as |IM-server|, >
877
878 *international: True
879 *.inputMethod: kinput2
880 *.preeditType: OverTheSpot
881<
882When using |OverTheSpot|, GUI Vim always connects to the IM Server even in
883Normal mode, so you can input your language with commands like "f" and "r".
884But when using one of the other two methods, GUI Vim connects to the IM Server
885only if it is not in Normal mode.
886
887If your IM Server does not support |OverTheSpot|, and if you want to use your
888language with some Normal mode command like "f" or "r", then you should use a
889localized xterm or an xterm which supports |XIM|
890
891If needed, you can set the XMODIFIERS environment variable:
892
893 sh: export XMODIFIERS="@im=input_server_name"
894 csh: setenv XMODIFIERS "@im=input_server_name"
895
896For example, when you are using kinput2 as |IM-server| and sh, >
897
898 export XMODIFIERS="@im=kinput2"
899<
900
901FULLY CONTROLLED XIM
902
903You can fully control XIM, like with IME of MS-Windows (see |multibyte-ime|).
904This is currently only available for the GTK GUI.
905
906Before using fully controlled XIM, one setting is required. Set the
907'imactivatekey' option to the key that is used for the activation of the input
908method. For example, when you are using kinput2 + canna as IM Server, the
909activation key is probably Shift+Space: >
910
911 :set imactivatekey=S-space
912
913See 'imactivatekey' for the format.
914
915==============================================================================
9168. Input on MS-Windows *mbyte-IME*
917
918(Windows IME support) *multibyte-ime* *IME*
919
920{only works Windows GUI and compiled with the |+multi_byte_ime| feature}
921
922To input multibyte characters on Windows, you have to use Input Method Editor
923(IME). In process of your editing text, you must switch status (on/off) of
924IME many many many times. Because IME with status on is hooking all of your
925key inputs, you cannot input 'j', 'k', or almost all of keys to Vim directly.
926
927This |+multi_byte_ime| feature help this. It reduce times of switch status of
928IME manually. In normal mode, there are almost no need working IME, even
929editing multibyte text. So exiting insert mode with ESC, Vim memorize last
930status of IME and force turn off IME. When re-enter insert mode, Vim revert
931IME status to that memorized automatically.
932
933This works on not only insert-normal mode, but also search-command input and
934replace mode.
935The options 'iminsert', 'imsearch' and 'imcmdline' can be used to chose
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000936the different input methods or disable them temporarily.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000937
938WHAT IS IME
939 IME is a part of East asian version Windows. That helps you to input
940 multibyte character. English and other language version Windows does not
941 have any IME. (Also there are no need usually.) But there is one that
942 called Microsoft Global IME. Global IME is a part of Internet Explorer
943 4.0 or above. You can get more information about Global IME, at below
944 URL.
945
946WHAT IS GLOBAL IME *global-ime*
947 Global IME makes capability to input Chinese, Japanese, and Korean text
948 into Vim buffer on any language version of Windows 98, Windows 95, and
949 Windows NT 4.0.
950 On Windows 2000 and XP it should work as well (without downloading). On
951 Windows 2000 Professional, Global IME is built in, and the Input Locales
952 can be added through Control Panel/Regional Options/Input Locales.
953 Please see below URL for detail of Global IME. You can also find various
954 language version of Global IME at same place.
955
956 - Global IME detailed information.
957 http://www.microsoft.com/windows/ie/features/ime.asp
958
959 - Active Input Method Manager (Global IME)
960 http://msdn.microsoft.com/workshop/misc/AIMM/aimm.asp
961
962 Support Global IME is a experimental feature.
963
964NOTE: For IME to work you must make sure the input locales of your language
965are added to your system. The exact location of this depends on the version
966of Windows you use. For example, on my W2P box:
9671. Control Panel
9682. Regional Options
9693. Input Locales Tab
9704. Add Installed input locales -> Chinese(PRC)
971 The default is still English (United Stated)
972
973
974Cursor color when IME or XIM is on *CursorIM*
975 There is a little cute feature for IME. Cursor can indicate status of IME
976 by changing its color. Usually status of IME was indicated by little icon
977 at a corner of desktop (or taskbar). It is not easy to verify status of
978 IME. But this feature help this.
979 This works in the same way when using XIM.
980
981 You can select cursor color when status is on by using highlight group
982 CursorIM. For example, add these lines to your _gvimrc: >
983
984 if has('multi_byte_ime')
985 highlight Cursor guifg=NONE guibg=Green
986 highlight CursorIM guifg=NONE guibg=Purple
987 endif
988<
989 Cursor color with off IME is green. And purple cursor indicates that
990 status is on.
991
992==============================================================================
9939. Input with a keymap *mbyte-keymap*
994
995When the keyboard doesn't produce the characters you want to enter in your
996text, you can use the 'keymap' option. This will translate one or more
997(English) characters to another (non-English) character. This only happens
998when typing text, not when typing Vim commands. This avoids having to switch
999between two keyboard settings.
1000
1001The value of the 'keymap' option specifies a keymap file to use. The name of
1002this file is one of these two:
1003
1004 keymap/{keymap}_{encoding}.vim
1005 keymap/{keymap}.vim
1006
1007Here {keymap} is the value of the 'keymap' option and {encoding} of the
1008'encoding' option. The file name with the {encoding} included is tried first.
1009
1010'runtimepath' is used to find these files. To see an overview of all
1011available keymap files, use this: >
1012 :echo globpath(&rtp, "keymap/*.vim")
1013
1014In Insert and Command-line mode you can use CTRL-^ to toggle between using the
1015keyboard map or not. |i_CTRL-^| |c_CTRL-^|
1016This flag is remembered for Insert mode with the 'iminsert' option. When
1017leaving and entering Insert mode the previous value is used. The same value
1018is also used for commands that take a single character argument, like |f| and
1019|r|.
1020For Command-line mode the flag is NOT remembered. You are expected to type an
1021Ex command first, which is ASCII.
1022For typing search patterns the 'imsearch' option is used. It can be set to
1023use the same value as for 'iminsert'.
1024
1025It is possible to give the GUI cursor another color when the language mappings
1026are being used. This is disabled by default, to avoid that the cursor becomes
1027invisible when you use a non-standard background color. Here is an example to
1028use a brightly colored cursor: >
1029 :highlight Cursor guifg=NONE guibg=Green
1030 :highlight lCursor guifg=NONE guibg=Cyan
1031<
1032 *keymap-file-format* *:loadk* *:loadkeymap* *E105*
1033The keymap file looks something like this: >
1034
1035 " Maintainer: name <email@address>
1036 " Last Changed: 2001 Jan 1
1037
1038 let b:keymap_name = "short"
1039
1040 loadkeymap
1041 a A
1042 b B comment
1043
1044The lines starting with a " are comments and will be ignored. Blank lines are
1045also ignored. The lines with the mappings may have a comment after the useful
1046text.
1047
1048The "b:keymap_name" can be set to a short name, which will be shown in the
1049status line. The idea is that this takes less room than the value of
1050'keymap', which might be long to distinguish between different languages,
1051keyboards and encodings.
1052
1053The actual mappings are in the lines below "loadkeymap". In the example "a"
1054is mapped to "A" and "b" to "B". Thus the first item is mapped to the second
1055item. This is done for each line, until the end of the file.
1056These items are exactly the same as what can be used in a |:lnoremap| command,
1057using "<buffer>" to make the mappings local to the buffer..
1058You can check the result with this command: >
1059 :lmap
1060The two items must be separated by white space. You cannot include white
1061space inside an item, use the special names "<Tab>" and "<Space>" instead.
1062The length of the two items together must not exceed 200 bytes.
1063
1064It's possible to have more than one character in the first column. This works
1065like a dead key. Example: >
1066 'a á
1067Since Vim doesn't know if the next character after a quote is really an "a",
1068it will wait for the next character. To be able to insert a single quote,
1069also add this line: >
1070 '' '
1071Since the mapping is defined with |:lnoremap| the resulting quote will not be
1072used for the start of another character.
1073
1074Although it's possible to have more than one character in the second column,
1075this is unusual. But you can use various ways to specify the character: >
1076 A a literal character
1077 A <char-97> decimal value
1078 A <char-0x61> hexadecimal value
1079 A <char-0141> octal value
1080 x <Space> special key name
1081
1082The characters are assumed to be encoded for the current value of 'encoding'.
1083It's possible to use ":scriptencoding" when all characters are given
1084literally. That doesn't work when using the <char-> construct, because the
1085conversion is done on the keymap file, not on the resulting character.
1086
1087The lines after "loadkeymap" are interpreted with 'cpoptions' set to "C".
1088This means that continuation lines are not used and a backslash has a special
1089meaning in the mappings. Examples: >
1090
1091 " a comment line
1092 \" x maps " to x
1093 \\ y maps \ to y
1094
1095If you write a keymap file that will be useful for others, consider submitting
1096it to the Vim maintainer for inclusion in the distribution:
1097<maintainer@vim.org>
1098
1099
1100HEBREW KEYMAP *keymap-hebrew*
1101
1102This file explains what characters are available in UTF-8 and CP1255 encodings,
1103and what the keymaps are to get those characters:
1104
1105glyph encoding keymap ~
1106Char utf-8 cp1255 hebrew hebrewp name ~
1107א 0x5d0 0xe0 t a 'alef
1108ב 0x5d1 0xe1 c b bet
1109ג 0x5d2 0xe2 d g gimel
1110ד 0x5d3 0xe3 s d dalet
1111ה 0x5d4 0xe4 v h he
1112ו 0x5d5 0xe5 u v vav
1113ז 0x5d6 0xe6 z z zayin
1114ח 0x5d7 0xe7 j j het
1115ט 0x5d8 0xe8 y T tet
1116י 0x5d9 0xe9 h y yod
1117ך 0x5da 0xea l K kaf sofit
1118כ 0x5db 0xeb f k kaf
1119ל 0x5dc 0xec k l lamed
1120ם 0x5dd 0xed o M mem sofit
1121מ 0x5de 0xee n m mem
1122ן 0x5df 0xef i N nun sofit
1123נ 0x5e0 0xf0 b n nun
1124ס 0x5e1 0xf1 x s samech
1125ע 0x5e2 0xf2 g u `ayin
1126ף 0x5e3 0xf3 ; P pe sofit
1127פ 0x5e4 0xf4 p p pe
1128ץ 0x5e5 0xf5 . X tsadi sofit
1129צ 0x5e6 0xf6 m x tsadi
1130ק 0x5e7 0xf7 e q qof
1131ר 0x5e8 0xf8 r r resh
1132ש 0x5e9 0xf9 a w shin
1133ת 0x5ea 0xfa , t tav
1134
1135Vowel marks and special punctuation:
1136הְ 0x5b0 0xc0 A: A: sheva
1137הֱ 0x5b1 0xc1 HE HE hataf segol
1138הֲ 0x5b2 0xc2 HA HA hataf patah
1139הֳ 0x5b3 0xc3 HO HO hataf qamats
1140הִ 0x5b4 0xc4 I I hiriq
1141הֵ 0x5b5 0xc5 AY AY tsere
1142הֶ 0x5b6 0xc6 E E segol
1143הַ 0x5b7 0xc7 AA AA patah
1144הָ 0x5b8 0xc8 AO AO qamats
1145הֹ 0x5b9 0xc9 O O holam
1146הֻ 0x5bb 0xcb U U qubuts
1147כּ 0x5bc 0xcc D D dagesh
1148הֽ 0x5bd 0xcd ]T ]T meteg
1149ה־ 0x5be 0xce ]Q ]Q maqaf
1150בֿ 0x5bf 0xcf ]R ]R rafe
1151ב׀ 0x5c0 0xd0 ]p ]p paseq
1152שׁ 0x5c1 0xd1 SR SR shin-dot
1153שׂ 0x5c2 0xd2 SL SL sin-dot
1154׃ 0x5c3 0xd3 ]P ]P sof-pasuq
1155װ 0x5f0 0xd4 VV VV double-vav
1156ױ 0x5f1 0xd5 VY VY vav-yod
1157ײ 0x5f2 0xd6 YY YY yod-yod
1158
1159The following are only available in utf-8
1160
1161Cantillation marks:
1162glyph
1163Char utf-8 hebrew name
1164ב֑ 0x591 C: etnahta
1165ב֒ 0x592 Cs segol
1166ב֓ 0x593 CS shalshelet
1167ב֔ 0x594 Cz zaqef qatan
1168ב֕ 0x595 CZ zaqef gadol
1169ב֖ 0x596 Ct tipeha
1170ב֗ 0x597 Cr revia
1171ב֘ 0x598 Cq zarqa
1172ב֙ 0x599 Cp pashta
1173ב֚ 0x59a C! yetiv
1174ב֛ 0x59b Cv tevir
1175ב֜ 0x59c Cg geresh
1176ב֝ 0x59d C* geresh qadim
1177ב֞ 0x59e CG gershayim
1178ב֟ 0x59f CP qarnei-parah
1179ב֪ 0x5aa Cy yerach-ben-yomo
1180ב֫ 0x5ab Co ole
1181ב֬ 0x5ac Ci iluy
1182ב֭ 0x5ad Cd dehi
1183ב֮ 0x5ae Cn zinor
1184ב֯ 0x5af CC masora circle
1185
1186Combining forms:
1187ﬠ 0xfb20 X` Alternative `ayin
1188ﬡ 0xfb21 X' Alternative 'alef
1189ﬢ 0xfb22 X-d Alternative dalet
1190ﬣ 0xfb23 X-h Alternative he
1191ﬤ 0xfb24 X-k Alternative kaf
1192ﬥ 0xfb25 X-l Alternative lamed
1193ﬦ 0xfb26 X-m Alternative mem-sofit
1194ﬧ 0xfb27 X-r Alternative resh
1195ﬨ 0xfb28 X-t Alternative tav
1196﬩ 0xfb29 X-+ Alternative plus
1197שׁ 0xfb2a XW shin+shin-dot
1198שׂ 0xfb2b Xw shin+sin-dot
1199שּׁ 0xfb2c X..W shin+shin-dot+dagesh
1200שּׂ 0xfb2d X..w shin+sin-dot+dagesh
1201אַ 0xfb2e XA alef+patah
1202אָ 0xfb2f XO alef+qamats
1203אּ 0xfb30 XI alef+hiriq (mapiq)
1204בּ 0xfb31 X.b bet+dagesh
1205גּ 0xfb32 X.g gimel+dagesh
1206דּ 0xfb33 X.d dalet+dagesh
1207הּ 0xfb34 X.h he+dagesh
1208וּ 0xfb35 Xu vav+dagesh
1209זּ 0xfb36 X.z zayin+dagesh
1210טּ 0xfb38 X.T tet+dagesh
1211יּ 0xfb39 X.y yud+dagesh
1212ךּ 0xfb3a X.K kaf sofit+dagesh
1213כּ 0xfb3b X.k kaf+dagesh
1214לּ 0xfb3c X.l lamed+dagesh
1215מּ 0xfb3e X.m mem+dagesh
1216נּ 0xfb40 X.n nun+dagesh
1217סּ 0xfb41 X.s samech+dagesh
1218ףּ 0xfb43 X.P pe sofit+dagesh
1219פּ 0xfb44 X.p pe+dagesh
1220צּ 0xfb46 X.x tsadi+dagesh
1221קּ 0xfb47 X.q qof+dagesh
1222רּ 0xfb48 X.r resh+dagesh
1223שּ 0xfb49 X.w shin+dagesh
1224תּ 0xfb4a X.t tav+dagesh
1225וֹ 0xfb4b Xo vav+holam
1226בֿ 0xfb4c XRb bet+rafe
1227כֿ 0xfb4d XRk kaf+rafe
1228פֿ 0xfb4e XRp pe+rafe
1229ﭏ 0xfb4f Xal alef-lamed
1230
1231==============================================================================
123210. Using UTF-8 *mbyte-utf8* *UTF-8* *utf-8* *utf8*
1233 *Unicode* *unicode*
1234The Unicode character set was designed to include all characters from other
1235character sets. Therefore it is possible to write text in any language using
1236Unicode (with a few rarely used languages excluded). And it's mostly possible
1237to mix these languages in one file, which is impossible with other encodings.
1238
1239Unicode can be encoded in several ways. The two most popular ones are UCS-2,
1240which uses 16-bit words and UTF-8, which uses one or more bytes for each
1241character. Vim can support all of these encodings, but always uses UTF-8
1242internally.
1243
1244Vim has comprehensive UTF-8 support. It appears to work in:
1245- xterm with utf-8 support enabled
1246- Athena, Motif and GTK GUI
1247- MS-Windows GUI
1248
1249Double-width characters are supported. This works best with 'guifontwide' or
1250'guifontset'. When using only 'guifont' the wide characters are drawn in the
1251normal width and a space to fill the gap. Note that the 'guifontset' option
1252is no longer relevant in the GTK+ 2 GUI.
1253
1254Up to two combining characters can be used. The combining character is drawn
1255on top of the preceding character. When editing text a composing character is
1256mostly considered part of the preceding character. For example "x" will
Bram Moolenaar402d2fe2005-04-15 21:00:38 +00001257delete a character and its following composing characters by default. If the
Bram Moolenaar071d4272004-06-13 20:20:40 +00001258'delcombine' option is on, then pressing 'x' will delete the combining
1259characters, one at a time, then the base character. But when inserting, you
1260type the first character and the following composing characters separately,
1261after which they will be joined. The "r" command will not allow you to type a
1262combining character, because it doesn't know one is coming. Use "R" instead.
1263
1264Bytes which are not part of a valid UTF-8 byte sequence are handled like a
1265single character and displayed as <xx>, where "xx" is the hex value of the
1266byte.
1267
1268Overlong sequences are not handled specially and displayed like a valid
1269character. However, search patterns may not match on an overlong sequence.
1270(an overlong sequence is where more bytes are used than required for the
1271character.) An exception is NUL (zero) which is displayed as "<00>".
1272
1273In the file and buffer the full range of Unicode characters can be used (31
1274bits). However, displaying only works for 16 bit characters, and only for the
1275characters present in the selected font.
1276
1277Useful commands:
1278- "ga" shows the decimal, hexadecimal and octal value of the character under
Bram Moolenaar402d2fe2005-04-15 21:00:38 +00001279 the cursor. If there are composing characters these are shown too. (If the
Bram Moolenaar071d4272004-06-13 20:20:40 +00001280 message is truncated, use ":messages").
1281- "g8" shows the bytes used in a UTF-8 character, also the composing
1282 characters, as hex numbers.
1283- ":set encoding=utf-8 fileencodings=" forces using UTF-8 for all files. The
1284 default is to use the current locale for 'encoding' and set 'fileencodings'
1285 to automatically the encoding of a file.
1286
1287
1288STARTING VIM
1289
1290If your current locale is in an utf-8 encoding, Vim will automatically start
1291in utf-8 mode.
1292
1293If you are using another locale: >
1294
1295 set encoding=utf-8
1296
1297You might also want to select the font used for the menus. Unfortunately this
1298doesn't always work. See the system specific remarks below, and 'langmenu'.
1299
1300
1301USING UTF-8 IN X-Windows *utf-8-in-xwindows*
1302
1303Note: This section does not apply to the GTK+ 2 GUI.
1304
1305You need to specify a font to be used. For double-wide characters another
1306font is required, which is exactly twice as wide. There are three ways to do
1307this:
1308
13091. Set 'guifont' and let Vim find a matching 'guifontwide'
13102. Set 'guifont' and 'guifontwide'
13113. Set 'guifontset'
1312
1313See the documentation for each option for details. Example: >
1314
1315 :set guifont=-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1
1316
1317You might also want to set the font used for the menus. This only works for
1318Motif. Use the ":hi Menu font={fontname}" command for this. |:highlight|
1319
1320
1321TYPING UTF-8 *utf-8-typing*
1322
1323If you are using X-Windows, you should find an input method that supports
1324utf-8.
1325
1326If your system does not provide support for typing utf-8, you can use the
1327'keymap' feature. This allows writing a keymap file, which defines a utf-8
1328character as a sequence of ASCII characters. See |mbyte-keymap|.
1329
1330Another method is to set the current locale to the language you want to use
1331and for which you have a XIM available. Then set 'termencoding' to that
1332language and Vim will convert the typed characters to 'encoding' for you.
1333
1334If everything else fails, you can type any character as four hex bytes: >
1335
1336 CTRL-V u 1234
1337
1338"1234" is interpreted as a hex number. You must type four characters, prepend
1339a zero if necessary.
1340
1341
1342COMMAND ARGUMENTS *utf-8-char-arg*
1343
1344Commands like |f|, |F|, |t| and |r| take an argument of one character. For
Bram Moolenaardf177f62005-02-22 08:39:57 +00001345UTF-8 this argument may include one or two composing characters. These need
Bram Moolenaar071d4272004-06-13 20:20:40 +00001346to be produced together with the base character, Vim doesn't wait for the next
1347character to be typed to find out if it is a composing character or not.
1348Using 'keymap' or |:lmap| is a nice way to type these characters.
1349
1350The commands that search for a character in a line handle composing characters
1351as follows. When searching for a character without a composing character,
1352this will find matches in the text with or without composing characters. When
1353searching for a character with a composing character, this will only find
1354matches with that composing character. It was implemented this way, because
1355not everybody is able to type a composing character.
1356
1357
1358==============================================================================
135911. Overview of options *mbyte-options*
1360
1361These options are relevant for editing multi-byte files. Check the help in
1362options.txt for detailed information.
1363
1364'encoding' Encoding used for the keyboard and display. It is also the
1365 default encoding for files.
1366
1367'fileencoding' Encoding of a file. When it's different from 'encoding'
1368 conversion is done when reading or writing the file.
1369
1370'fileencodings' List of possible encodings of a file. When opening a file
1371 these will be tried and the first one that doesn't cause an
1372 error is used for 'fileencoding'.
1373
1374'charconvert' Expression used to convert files from one encoding to another.
1375
1376'formatoptions' The 'm' flag can be included to have formatting break a line
1377 at a multibyte character of 256 or higher. Thus is useful for
1378 languages where a sequence of characters can be broken
1379 anywhere.
1380
1381'guifontset' The list of font names used for a multi-byte encoding. When
1382 this option is not empty, it replaces 'guifont'.
1383
1384'keymap' Specify the name of a keyboard mapping.
1385
1386==============================================================================
1387
1388Contributions specifically for the multi-byte features by:
1389 Chi-Deok Hwang <hwang@mizi.co.kr>
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001390 Nam SungHyun <namsh@kldp.org>
Bram Moolenaar071d4272004-06-13 20:20:40 +00001391 K.Nagano <nagano@atese.advantest.co.jp>
1392 Taro Muraoka <koron@tka.att.ne.jp>
1393 Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
1394
1395 vim:tw=78:ts=8:ft=help:norl: