vim 插件配置

" 使用vim-plug添加插件
call plug#begin('~/.vim/plugged')
"" 添加YCM插件
Plug 'ycm-core/YouCompleteMe'
Plug 'preservim/nerdtree'
Plug 'kien/rainbow_parentheses.vim'
Plug 'pangloss/vim-javascript'

call plug#end()

" YCM peizhi
let g:ycm_global_ycm_extra_conf='~/.vim/YouCompleteMe/.ycm_extra_conf.py'
" 开启 YCM 基于标签引擎
let g:ycm_collect_identifiers_from_tags_files=1
" 从第2个键入字符就开始罗列匹配项
let g:ycm_min_num_of_chars_for_completion=2
" 禁止缓存匹配项,每次都重新生成匹配项
let g:ycm_cache_omnifunc=0
" 语法关键字补全
let g:ycm_seed_identifiers_with_syntax=1


" nerdtree配置
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * NERDTree | if argc() > 0 || exists("s:std_in") | wincmd p | endif
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif


" <f5> refresh ctags
:nnoremap <f5> :!ctags -R<CR>

" 可以在用户目录下(~/)打开.vimrc文件,如果没有就自己创建一个,输入下面的设置
set tags=tags;
set autochdir

" 文件保存时自动执行ctags
autocmd BufWritePost *.c,*.h,*.cpp,*.hpp silent! execute '!ctags -a -f ./tags -e -R ' . expand('<cword>')

 

posted @ 2024-09-14 00:16  年华似水゛  阅读(3)  评论(0编辑  收藏  举报