Changeset 5672

Show
Ignore:
Timestamp:
01/28/08 15:31:16 (5 years ago)
Author:
omoon
Message:

dotfiles/vim/omoon-vimrc: 文字コード自動判定いったんやめ。きちんと把握してから。

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dotfiles/vim/omoon-vimrc

    r5353 r5672  
    88set autoindent 
    99sy on 
     10set fileencoding=utf8 
     11 
    1012"set bomb 
    1113set hidden 
    1214colorscheme darkblue 
    1315set laststatus=2 
    14  
     16set ambiwidth=double 
    1517set runtimepath+=~/.vim/hatena 
    1618let g:hatena_user='omoon' 
     
    8789set complete+=k 
    8890 
    89 " 文字コードの自動認識 
    90 if &encoding !=# 'utf-8' 
    91 set encoding=japan 
    92 set fileencoding=japan 
     91" 改行コードの自動認識 
     92set fileformats=unix,dos,mac 
     93" □とか○の文字があってもカーソル位置がずれないようにする 
     94if exists('&ambiwidth') 
     95set ambiwidth=double 
    9396endif 
    94 if has('iconv') 
    95 let s:enc_euc = 'euc-jp' 
    96 let s:enc_jis = 'iso-2022-jp' 
    97 " iconvがeucJP-msに対応しているかをチェック 
    98 if iconv("¥x87¥x64¥x87¥x6a", 'cp932', 'eucjp-ms') ==# "¥xad¥xc5¥xad¥xcb" 
    99 let s:enc_euc = 'eucjp-ms' 
    100 let s:enc_jis = 'iso-2022-jp-3' 
    101 " iconvがJISX0213に対応しているかをチェック 
    102 elseif iconv("¥x87¥x64¥x87¥x6a", 'cp932', 'euc-jisx0213') ==# "¥xad¥xc5¥xad¥xcb" 
    103 let s:enc_euc = 'euc-jisx0213' 
    104 let s:enc_jis = 'iso-2022-jp-3' 
    105 endif 
    106 " fileencodingsを構築 
    107 if &encoding ==# 'utf-8' 
    108 let s:fileencodings_default = &fileencodings 
    109 let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932' 
    110 let &fileencodings = &fileencodings .','. s:fileencodings_default 
    111 unlet s:fileencodings_default 
    112 else 
    113 let &fileencodings = &fileencodings .','. s:enc_jis 
    114 set fileencodings+=utf-8,ucs-2le,ucs-2 
    115 if &encoding =~# '^¥(euc-jp¥|euc-jisx0213¥|eucjp-ms¥)$' 
    116 set fileencodings+=cp932 
    117 set fileencodings-=euc-jp 
    118 set fileencodings-=euc-jisx0213 
    119 set fileencodings-=eucjp-ms 
    120 let &encoding = s:enc_euc 
    121 let &fileencoding = s:enc_euc 
    122 else 
    123 let &fileencodings = &fileencodings .','. s:enc_euc 
    124 endif 
    125 endif 
    126 " 定数を処分 
    127 unlet s:enc_euc 
    128 unlet s:enc_jis 
    129 endif 
    130 " 日本語を含まない場合は fileencoding に encoding を使うようにする 
    131     if has('autocmd') 
    132 function! AU_ReCheck_FENC() 
    133     if &fileencoding =~# 'iso-2022-jp' && search("[^¥x01-¥x7e]", 'n') == 0 
    134     let &fileencoding=&encoding 
    135     endif 
    136     endfunction 
    137 autocmd BufReadPost * call AU_ReCheck_FENC() 
    138     endif 
    139     " 改行コードの自動認識 
    140     set fileformats=unix,dos,mac 
    141     " □とか○の文字があってもカーソル位置がずれないようにする 
    142     if exists('&ambiwidth') 
    143     set ambiwidth=double 
    144     endif 
    145