个人VIM配置(C语言)

操作系统:CentOS7.x

特色:C/C++语法, 底部显示文件完整路径

请切换到root用户登录:

1. 安装vim

yum -y install vim

2. 配置vi命令转vim

echo "vi='vim'" >> /etc/profile

source /etc/profile

注意:vim用单引号括起

3. 添加vim设置命令

filetype plugin indent on
syntax on
set nu
filetype on
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set history=1000
color evening
set showmatch
set autoindent
set cindent
set showcmd
set smartindent
set nobackup
set noswapfile
highlight Function cterm=bold, ctermbg=red
set cursorline
colorscheme darkblue

"设置底部显示文件路径
set laststatus=2
highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue
function! CurDir()
    let curdir = substitute(getcwd(),$HOME,"~","g")
    return curdir
endfunction
set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]
set ruler

将内容拷贝到配置文件/etc/vimrc 尾部即可,最终展示效果:

个人VIM配置(C语言)

 

 

 

;