配置Vim的显示样式

进入用户目录:

cd ~

 

复制系统的vim配置到用户的目录下:

cp -r /usr/share/vim/vimrc ~/.vimrc

如果无法编辑,可能时因为/usr/share/vim/vimrc 是一个连接,可能就需要修改源配置文件了,

 

修改的内容如下:

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 compatiblity
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
" Dont't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup

syntax on " 语法高亮

autocmd InsertLeave * se nocul
autocmd InsertEnter * se cul
" 用浅色高亮当前行

set tabstop=4
" Tab键的宽度

set softtabstop=4
set shiftwidth=4
" 统一缩进为4

set number
" 显示行号

colorscheme pablo
" 设置颜色主题,主题在/usr/share/vim/vim73/colors

set ruler
" 在编辑过程中,在右下角显示光标位置的状态行

set scrolloff=3
" 光标移动到buffer的顶部和底部时保持3行距离

 

posted @ 2018-03-15 18:22  一菲聪天  阅读(711)  评论(0编辑  收藏  举报