set nocompatible " 这是必需的
filetype off " 这是必需的
" 寻找全局配置文件
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py'
" YouCompleteMe
" Python Semantic Completion
let g:ycm_python_binary_path = '/usr/bin/python3'
" C family Completion Path
" 跳转快捷键
nnoremap <c-k> :YcmCompleter GoToDeclaration<CR>|
nnoremap <c-h> :YcmCompleter GoToDefinition<CR>|
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>|
" 停止提示是否载入本地ycm_extra_conf文件
let g:ycm_confirm_extra_conf = 0
" 语法关键字补全
let g:ycm_seed_identifiers_with_syntax = 1
" 开启 YCM 基于标签引擎
let g:ycm_collect_identifiers_from_tags_files = 1
" 从第2个键入字符就开始罗列匹配项
let g:ycm_min_num_of_chars_for_completion=2
" 在注释输入中也能补全
let g:ycm_complete_in_comments = 1
" 在字符串输入中也能补全
let g:ycm_complete_in_strings = 1
" 注释和字符串中的文字也会被收入补全
let g:ycm_collect_identifiers_from_comments_and_strings = 1
" 弹出列表时选择第1项的快捷键(默认为<TAB>和<Down>)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
" 弹出列表时选择前1项的快捷键(默认为<S-TAB>和<UP>)
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
" 主动补全, 默认为<C-Space>
"let g:ycm_key_invoke_completion = ['<C-Space>']
" 停止显示补全列表(防止列表影响视野), 可以按<C-Space>重新弹出
"let g:ycm_key_list_stop_completion = ['<C-y>']
" Taglist------------------------------------------------------
let Tlist_Ctags_Cmd='ctags'
let Tlist_WinWidth=28
let Tlist_Exit_OnlyWindow=1
let Tlist_Inc_Winwidth=0 " 配置打开函数列表的时候不改变窗口大小
let Tlist_Use_Right_Window=1 " 配置函数列表挂靠在屏幕右手边
let Tlist_File_Fold_Auto_Close=1 " 配置自动关闭非活动的文件
let Tlist_Exit_OnlyWindow=1 " 配置当前只有函数列表窗口的时候退出vim
let Tlist_Process_File_Always=1 " Update tags immediately
let Tlist_Show_One_File=0 " Show more file variables
map <F3> :TlistToggle<cr> : 快捷键F3切换函数列表
" 你在此设置运行时路径
set rtp+=~/.vim/bundle/Vundle.vim
" vundle初始化
call vundle#begin()
" 这应该始终是第一个
call vundle#end()
"vim configuration
set modelines=0
"设置更好的删除
set backspace=2
syntax on "语法高亮
"用浅色高亮当前行
autocmd InsertLeave * se nocul
autocmd InsertEnter * se cul
set smartindent "智能对齐
set autoindent "自动对齐
set confirm "在处理未保存或只读文件的时候,弹出确认框
set tabstop=4 "tab键的宽度
set softtabstop=4
set shiftwidth=4 "统一缩进为4
set expandtab "不要用空格替代制表符
set number "显示行号
set history=50 "历史纪录数
set hlsearch
set incsearch "搜素高亮,搜索逐渐高亮
set gdefault "行内替换
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936,utf-16,big5,euc-jp,latin1 "编码设置
set guifont=Menlo:h16:cANSI "设置字体
set langmenu=zn_CN.UTF-8
set helplang=cn "语言设置
set ruler "在编辑过程中,在右下角显示光标位置的状态行
set laststatus=1 "总是显示状态行
set showcmd "在状态行显示目前所执行的命令,未完成的指令片段也会显示出来
set scrolloff=3 "光标移动到buffer的顶部和底部时保持3行的距离
set showmatch "高亮显示对应的括号
set matchtime=5 "对应括号高亮时间(单位是十分之一秒)
set autowrite "在切换buffer时自动保存当前文件
set wildmenu "增强模式中的命令行自动完成操作
set linespace=2 "字符间插入的像素行数目
set whichwrap=b,s,<,>,[,] "开启normal 或visual模式下的backspace键空格键,左右方向键,insert或replace模式下的左方向键,右方向键的跳行功能
filetype plugin indent on "分为三部分命令:file on,file plugin on,file indent on 分别是自动识别文件类型, 用用文件类型脚本,使用缩进定义文件
set foldenable "允许折叠
set cursorline "突出显示当前行
set magic "设置魔术?神马东东
set ignorecase "搜索忽略大小写
filetype on "打开文件类型检测功能
set background=dark
set t_Co=256 "256色
set mouse=a "允许鼠标
set nocompatible " 这是必需的
filetype off " 这是必需的
" NERDTree------------------------------------------------------
let NERDTreeQuitOnOpen=1 " Nerdtree is quit, when file is opened
let NERDTreeShowBookmarks=1 " Display bootmark
" let NERDTreeChDirMode=2 " Root is default directory
" let mapleader = ","
map <F4> :NERDTreeToggle<CR>
map <C-F4> :NERDTreeFind<CR>
" Cscope------------------------------------------------------
if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database
if filereadable("cscope.out")
cs add cscope.out
" else add pointed
elseif $CSCOPE_DB!=""
cs add $CSCOPE_DB
endif
set csverb
endif
" shortcuts
nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :cs find f <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>i :cs find i <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Vundle--------------------------------------------------------
"set rtp+=~/.vim/bundle/Vundle.vim
call vundle#rc()
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'Valloric/YouCompleteMe'
Plugin 'tpope/vim-surround'
Plugin 'bling/vim-airline'
Plugin 'taglist.vim'
Plugin 'cscope.vim'
Plugin 'The-Nerd-Commenter'
Plugin 'ctrlp.vim'
Plugin 'Source-Explorer-srcexpl.vim'
filetype plugin indent on " required