fileencodings
7.0 になって default が追加されるようになったようだ。なので euc-jp な環境で cp932 なファイルを開くと文字化け多発。
fileencodings を組み立てる前に version >= 700 なら "-= default" してやれば良い。
えらそーに .vimrc をさらしてみる。
" Created: 2004-03-20 1st " Last Change: 2006-05-15 02:37. if &encoding !=# 'utf-8' set encoding=japan endif set fileencoding=japan if has('iconv') if version >= 700 set fileencodings-=default endif let s:enc_euc = 'euc-jp' let s:enc_jis = 'iso-2022-jp' if iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb" let s:enc_euc = 'euc-jisx0213' let s:enc_jis = 'iso-2022-jp-3' endif if &encoding ==# 'utf-8' let s:fileencodings_default = &fileencodings let &fileencodings = s:enc_jis . ',' . s:enc_euc . ',cp932' let &fileencodings = &fileencodings . ',' . s:fileencodings_default unlet s:fileencodings_default else let &fileencodings = &fileencodings .','. s:enc_jis set fileencodings+=utf-8,ucs-2le,ucs-2 if &encoding =~# '^euc-\%(jp\|jisx0213\)$' set fileencodings+=cp932 set fileencodings-=euc-jp set fileencodings-=euc-jisx0213 let &encoding = s:enc_euc else let &fileencodings = &fileencodings .','. s:enc_euc endif endif unlet s:enc_euc unlet s:enc_jis endif " setting for UTF-8 in xterm if has('unix') && $LANG != "ja_JP.eucJP" && $TERM =~# 'u*xterm' set termencoding=utf-8 endif set fileformats+=mac set tabstop=4 shiftwidth=4 softtabstop=4 set autoindent set smarttab set shiftround set noruler set nobackup nowritebackup noswapfile backupcopy=no set shortmess+=fI set viminfo= set shellslash set nowrap set hlsearch set linebreak set showbreak=> set showmatch set listchars=extends:>,precedes:<,eol:$ set noshowcmd set matchpairs+=<:> set cmdheight=1 set linespace=0 set laststatus=2 set statusline=%=%t%{BuildStatusLine()}%m%h%r set noignorecase set smartcase set novisualbell t_vb= set noerrorbells set printoptions+=syntax:y set scrolloff=3 " Keep lines between the cursor and bottom/top set noequalalways set showfulltag set complete+=d set nojoinspaces set undolevels=100 set maxfuncdepth=999 set ttyfast if 0 " for uim set timeout set timeoutlen=1000 set ttimeoutlen=10 endif set wildignore=*.o,*.obj,*.core,*.mp3,*.flac,*.avi set modeline set browsedir=buffer set nrformats-=octal set cpoptions-=aA set fillchars=vert:\ ,fold:- set path=.,/usr/include,/usr/local/include,/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include/g++-v3,~/devel,, set tags+=~/devel/std-tags set cino=:0 set noic set isfname+=32 set mouse=a set nofoldenable filetype plugin on language messages C " Favarits ia #i #include ia #d #define ia @p @param ia @r @return ia @e @exception ia @b @brief nmap <silent> ,v :n ~/.vimrc<CR> nmap <silent> ,V :n ~/.gvimrc<CR> nmap <silent> ,d :n ~/diary/diary.txt<CR> nmap <silent> ,w :call ToggleLineWrap()<CR> nmap <silent> ,. :Exp<CR> nmap <silent> ,, :BufExp<CR> nmap <silent> <F1> <NOP> nmap <silent> Q <NOP> nmap <silent> K <NOP> nmap <silent> __ :A<CR> nmap <silent> ,f [{V%zf nmap <silent> <C-n> :nohl<CR> nmap <silent> <M-o> :copen<CR> nmap <silent> <M-j> :cn<CR> nmap <silent> <M-k> :cp<CR> nmap <silent> ,2 a<C-R>=strftime("%Y-%m-%d")<CR><ESC> " ^? = <C-v> + <C-8> " ^_ = <C-v> + <C-7> " for gVim let did_install_default_menus = 0 let did_install_syntax_menu = 0 let skip_syntax_sel_menu = 1 " Change directory command -nargs=0 Cd cd %:p:h " Make & copen command -nargs=* Make wa | make <args> " hatedara command! -nargs=0 HateSplit exe "!cd ~/diary/ && perl hws.pl % && cd -" command! -nargs=0 HateDara exe "!cd ~/diary/ && perl hw.pl && cd -" autocmd BufNewFile *.cpp 0r ~/.vim/template/skelton.cpp autocmd BufNewFile *.h 0r ~/.vim/template/skelton.h autocmd BufNewFile *.hpp 0r ~/.vim/template/skelton.hpp autocmd BufRead *.cp setf cpp autocmd BufRead *.txt setlocal wrap " matchparen.vim if version >= 700 let loaded_matchparen = 1 endif " explorer.vim if version < 700 let g:explDateFormat = '%Y-%m-%d %H:%M' let g:explHideFiles = '\.o$,\.class$' endif " netrw.vim if version >= 700 nmap <unique> gx <Plug>NetrwBrowseX endif let g:netrw_list_hide='\.class$,\.o$' " bufexplorer.vim let g:bufExplorerSortBy = 'name' let g:bufExplorerOpenMode = 1 " a.vim let g:alternateExtensions_h = "c,cp,cpp,cxx,cc,CC" let g:alternateExtensions_cp = "h" " taglist.vim let g:Tlist_Ctags_Cmd = 'exuberant-ctags' let g:Tlist_File_Fold_Auto_Close = 1 " keisen.vim let keisen_type = 2 " autodate.vim let autodate_lines = 10 let autodate_start_line = 2 let autodate_keyword_pre = '\cLast Changed\?:' let autodate_format = '%Y-%m-%d %H:%M' " svncommand.vim let g:SVNCommandDeleteOnHide = 1 " xterm16.vim let xterm16_colormap = 'softlight' " 'soft', 'softlight', 'standard', 'allblue' let xterm16_brightness = 'high' " 'low', 'med', 'high', 'default', custom levels. let xterm16bg_Normal = 'none' " Transparent background let xterm16_termtype = 'rxvt' " ps_color.vim let psc_style = 'warm' let psc_cterm_style = 'default' let psc_fontface = 'mixed' let psc_statement_different_from_type = 1 " Build status line text function! BuildStatusLine() let str = &fileformat if has("multi_byte") if &fileencoding != "" let str = &fileencoding . ':' . str else let str = &encoding . ':' . str endif endif let str = '[' . str . ']' return str endfunction " Toggle wrap function! ToggleLineWrap() if &wrap == 1 set nowrap else set wrap endif endfunction " Auto detecte incsearch option function! s:AutoIncSearch() if line2byte(line("$")) < 10000000 set incsearch else set noincsearch endif endfunction autocmd BufReadPost * call s:AutoIncSearch() " vim -b : edit binary using xxd-format! augroup Binary au! au BufReadPre *.bin let &bin=1 au BufReadPost *.bin if &bin | %!xxd au BufReadPost *.bin set ft=xxd | endif au BufWritePre *.bin if &bin | %!xxd -r au BufWritePre *.bin endif au BufWritePost *.bin if &bin | %!xxd au BufWritePost *.bin set nomod | endif augroup END syntax on if has('unix') && !has('gui_running') if &term =~ "linux" set term=builtin_linux elseif &term =~ "jfbterm" set term=builtin_linux elseif &term =~ "cons25" set term=builtin_cons25 elseif &term =~ "Darwin" set term=beos-ansi else set term=builtin_xterm set t_Co=256 if has("terminfo") set t_Sf=^[[3%p1%dm set t_Sb=^[[4%p1%dm else set t_Sf=^[[3%dm set t_Sb=^[[4%dm endif endif if &term =~ "builtin_linux" colorscheme oceandeep elseif &term =~ "builtin_xterm" || &term =~ "rxvt" "colorscheme desert256 " dark "colorscheme ps_color " light colorscheme xterm16 " dark or light hi NonText cterm=NONE ctermfg=NONE " for xterm16 endif " コンソール版で環境変数$DISPLAYが設定されていると起動が遅くなる件へ対応 if has('xterm_clipboard') set clipboard=autoselect,exclude:cons\\\|linux\\\|cygwin endif endif " vim:set fenc=euc-jp nomodified: