Can't see the Chinese characters in VIM

I find that when I type Chinese characters (encoded with UTF-8) into VIM, I cannot see them at all while they do exist there. I can copy and paste them into other text editors and it seems everything is fine. How can I fix this problem?

2 Answers

you are not using a font which contains the glyphs needed to display the characters you typed.

so, choose the right font via

:set guifont=*

or

:set guifontwide=*

which would pop up a font-selection-dialog. and once you have a working font make it permanent by putting

set guifont=YOURFONT

to your .gvimrc / .vimrc

3

Open the VIM configuration file

$ sudo -H gedit /etc/vim/vimrc

Added following lines:

set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8

Save and exit, and terminal command:

$ source /etc/vim/vimrc

At this time VIM will correctly display Chinese.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like