| | 68 | |
| | 69 | "エンコーディング via kana/dot.vimrc |
| | 70 | if !exists('did_encoding_settings') && has('iconv') |
| | 71 | let s:enc_euc = 'euc-jp' |
| | 72 | let s:enc_jis = 'iso-2022-jp' |
| | 73 | |
| | 74 | " Does iconv support JIS X 0213 ? |
| | 75 | if iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb" |
| | 76 | let s:enc_euc = 'euc-jisx0213,euc-jp' |
| | 77 | let s:enc_jis = 'iso-2022-jp-3' |
| | 78 | endif |
| | 79 | |
| | 80 | " Make fileencodings |
| | 81 | let &fileencodings = 'ucs-bom' |
| | 82 | if &encoding !=# 'utf-8' |
| | 83 | let &fileencodings = &fileencodings . ',' . 'ucs-2le' |
| | 84 | let &fileencodings = &fileencodings . ',' . 'ucs-2' |
| | 85 | endif |
| | 86 | let &fileencodings = &fileencodings . ',' . s:enc_jis |
| | 87 | |
| | 88 | if &encoding ==# 'utf-8' |
| | 89 | let &fileencodings = &fileencodings . ',' . s:enc_euc |
| | 90 | let &fileencodings = &fileencodings . ',' . 'cp932' |
| | 91 | elseif &encoding =~# '^euc-\%(jp\|jisx0213\)$' |
| | 92 | let &encoding = s:enc_euc |
| | 93 | let &fileencodings = &fileencodings . ',' . 'utf-8' |
| | 94 | let &fileencodings = &fileencodings . ',' . 'cp932' |
| | 95 | else " cp932 |
| | 96 | let &fileencodings = &fileencodings . ',' . 'utf-8' |
| | 97 | let &fileencodings = &fileencodings . ',' . s:enc_euc |
| | 98 | endif |
| | 99 | let &fileencodings = &fileencodings . ',' . &encoding |
| | 100 | |
| | 101 | unlet s:enc_euc |
| | 102 | unlet s:enc_jis |
| | 103 | |
| | 104 | let did_encoding_settings = 1 |
| | 105 | endif |