在Mac os 中用vim 进行文本编辑是家常便饭,但Vim 在Mac os默认情况是没有进行配置的,显示的效果如下:
如何显示能够显示富文本格式?
1.确认有没有当前用户Vim 配置文件存在(当前用户的配置文件路径在 ~/.vimrc):
$ locate vimrc
/usr/share/vim/vim80/gvimrc_example.vim
/usr/share/vim/vim80/vimrc_example.vim
/usr/share/vim/vimrc
2.如果没有新增配置文件:
```
$ touch ~/.vimrc
或
$vim ~/.vimrc
3.在里面添加你需要的配置并保存:
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"=> Encoding
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
setencoding=utf-8
setfileencoding=utf-8
setfileencodings=ucs-bom,utf-8,chinese
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"=> Font and scheme
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"用于语法高亮的配色方案
colorschemeevening
"colorscheme torte
"设置 gvim 显示字体
"1. YaHei Consolas Hybrid ,这个字体需要单另安装。对于中文字体,我有种无语的感觉。
"set guifont=YaHei_Consolas_Hybrid:h12
"2. 编程字体
"set guifont=Dejavu\ Sans\ Mono\ 12
"set guifont=Lucida\ Sans\ Typewriter\ 12
"3. 日文环境下默认可以使用的中文字体
"set guifont=NSimSun:h12
"开启语法高亮
syntaxenable
"允许用指定语法高亮配色方案替换默认方案
syntaxon
"设置 tab 宽度
settabstop=4
"设置行号
setnu
"Number of spaces to use for each step of (auto)indnt. Used for 'cindent',
">>, << etc.
setshiftwidth=4
"When on, lines longer than the width of the window will wrap and displaying
"continues on the next line.
setnowrap