本文将自己的.vimrc文件,拷贝记录到自己的博客,方便以后在不同的电脑上快速配置,也方便初学者可以借鉴。欢迎大家提出指正!
"实用配置
set autoread
set nocompatible
set number
set paste
syntax on
set cursorline
colorscheme torte
filetype on
filetype plugin indent on
set clipboard=unnamed
set fillchars=vert:\ ,stl:\ ,stlnc:\
set scrolloff=3
"底部状态栏
set laststatus=2
set statusline=\ %F%m%r%h%w\ [TYPE=%Y]\ [%{&fileformat}]\ [%{&encoding}]%=[POS=%l/%L,%c]\ [%p%%]\ %{strftime(\"%Y-%m-%d\ %H:%M\")}\
"自动缩进
set autoindent
set smartindent
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
"括号自动补全
inoremap ' ''<ESC>i
inoremap " ""<ESC>i
inoremap ` ``<ESC>i
inoremap ( ()<ESC>i
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap [ []<ESC>i
inoremap ] <c-r>=ClosePair(']')<CR>
inoremap { {<CR>}<ESC>O
inoremap } <c-r>=ClosePair('}')<CR>
function! ClosePair(char)
if getline('.')[col('.')-1]==a:char
return "\<Right>"
else
return a:char
endif
endfunction
"根据缩进自动折叠,4级缩进,不显示折叠标记(本人不喜欢用,所以注释掉了)
"set foldmethod=indent
"set foldlevel=4
"set foldcolumn=0
"vim自带自动语句补全功能,需提前利用ctags在include文件中生成tag文件,再添加路径即可
set completeopt=menu,menuone
set wildmenu
set tags+=./tags
set tags+=/usr/local/include/opencv4/opencv2/opencv.tags
set tags+=/usr/include/c++/4.8.2/stdcpp.tags
let OmniCpp_NamespaceSearch=2
let OmniCpp_ShowPrototypeInAbbr=1
let OmniCpp_MayCompleteScope=1
let OmniCpp_MayCompleteDot=1
let OmniCpp_MayCompleteArrow=1
let OmniCpp_MayCompleteScope=1
"let OmniCpp_DefaultNameSpaces=["std","_GLIBCXX_STD"]
let OmniCpp_DisplayMode=1
打开C++文件效果如下:
打开python文件效果:
(持续更新中……)
来源:CSDN
作者:Johnny1014
链接:https://blog.csdn.net/johnny0316/article/details/104535925