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=YOURFONTto your .gvimrc / .vimrc
3Open the VIM configuration file
$ sudo -H gedit /etc/vim/vimrcAdded following lines:
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8Save and exit, and terminal command:
$ source /etc/vim/vimrcAt this time VIM will correctly display Chinese.
2