Vim遇到cp936字符自动转成utf8并保存
function! ChangeCharacterToUTF8()
if(&fileencoding=='cp936')
set fileencoding=utf-8
w
endif
endfunction
autocmd BufNewFile,BufRead *.josn,*.c,*.txt,*.cpp,*.htm,*.html,*.php,*.py,*.sh,*.js,*.css :cal ChangeCharacterToUTF8()