Skip to main content

vim-bash-encoding-中文显示

vim-bash-encoding-中文显示.md

在vim的编辑界面输入 :set encoding=utf-8, 可以将文本中乱码的中文正确显示.

也可以直接修改~/.vimrc文件, 永久生效.

Set encoding and fileencoding to utf-8 in Vim

https://stackoverflow.com/questions/16507777/set-encoding-and-fileencoding-to-utf-8-in-vim

In the first case with set encoding=utf-8, you'll change the output encoding that is shown in the terminal.

In the second case with set fileencoding=utf-8, you'll change the output encoding of the file that is written.

As stated by @Dennis, you can set them both in your ~/.vimrc if you always want to work in utf-8.