首先找到系统自带的vim配置文件:
➜ cat /usr/share/vim/vimrc
" 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
let skip_defaults_vim=1
将其复制到当前用户的根目录下:
➜ cp /usr/share/vim/vimrc ~/.vimrc
➜ cd ~
➜ vim .vimrc
增加以下三行:
syntax on //主要是这一句
set nu! //显示行数,可以不加
set autoindent //自动缩进,加不加也可以
保存之后无需重启系统,即时生效。
网友评论