vi/vim 中文乱码

linux下,用vi、vim编辑文件时,可能会碰到中文乱码。
由于在windows下默认是gb编码,而vim默认是utf-8(gedit默认也是utf-8),所以打开会成乱码。修改了一下配置文件,使vi、vim支持gb编码就好了。
$vi ~/.vimrc

let &termencoding=&encoding
set fileencodings=utf-8,gbk

$:wq
再次打开vi、vim,中文显示就正常了。

Leave a comment

0 Comments.

Leave a Reply


[ Ctrl + Enter ]

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word