if has("multi_byte")if has("multi_byte")
set encoding=utf-8
setglobal fileencoding=big5
set fileencoding=big5
set bomb
set termencoding=big5
set fileencodings=ucs-bom,taiwan,utf-8,prc,ucs-2le,latin1
set guifont=Consolas:h11
set guifontwide=細明體:h11
else
echoerr "Sorry, this version of (g)vim was not compiled with multi_byte"
endif
has("multi_byte")測試在 compile vim 時有沒有加入 multibyte 支援。如果沒有,就不能用 Unicode 了。
"encoding"設定 vim 內部如何表示字元。如果要用 Unicode 的話,Utf-8 是個不錯的選擇。
"fileencoding" sets the encoding for a particular file (local to buffer);
:setglobal sets the default value. An empty value can also be used: it defaults to same as "encoding". Or you may want to set one of the ucs encodings, It might make the same disk file bigger or smaller depending on your particular mix of characters. Also, IIUC, utf-8 is always big-endian (high bit first) while ucs can be big-endian or little-endian, so if you use it, you will probably need to set "bomb" (see below).
"bomb" (boolean)如果設定的話,vim 會在 ucs 的檔案開頭放個 "byte order mark"。這個和大多數不是 ucs 的檔案無關(utf-8, iso-8859, etc.) 有興趣想瞭解的人可以看看 http://www.unicode.org/faq/utf_bom.html 。
"termencoding" defines how your keyboard encodes what you type. The value you put there will depend on your locale: iso-8859-15 is Latin1 + Euro currency sign, but you may want something else for, say, an Eastern European keyboard.
"fileencodings" defines the heuristic to set "fileencoding" (local to buffer) when reading an existing file. The first one that matches will be used (and, IIUC, if there is no match, Vim falls back on Latin1).
Ucs-bom is "ucs with byte-order-mark"; it must not come after utf-8 if you want it to be used.