Mac系统自带的vim编辑器是不显示行号及高亮显示的,可以拷贝vimrc文件并对其进行修改。


1.拷贝vimrc文件

1
cp /usr/share/vim/vimrc ~/.vimrc                                                                                                         

2.修改.vimrc文件归读写属性

1
sudo  chmod o+w  .vimrc

3.修改vimrc文件

1
vim .vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
" Configuration file for vim
set modelines=0 " CVE-2007-2438

" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing

" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup

###修改选项
syntax on #高亮显示
set nu #显示行号