Vim Plug Scripts
" ************************* common settings ************************
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
set encoding=utf-8
set fileencoding=utf-8
" ************************** my plugin start ************************
" ************************** my plugin start************************
" ************************** my plugin start************************
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
" 目录树
Plug 'preservim/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
" git 版本信息
Plug 'Xuyuanp/nerdtree-git-plugin'
" 配色
Plug 'tomasr/molokai'"
" Vim状态栏插件,包括显示行号,列号,文件类型,文件名,以及Git状态
" 状态增强
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" 搜索
Plug 'ctrlpvim/ctrlp.vim'
" format
Plug 'chiel92/vim-autoformat'
" nginx
Plug 'chr4/nginx.vim'
" markdown
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
" dockerfile
Plug 'ekalinin/dockerfile.vim'
" auto pair
Plug 'jiangmiao/auto-pairs'
" groovy plugin
Plug 'sheerun/vim-polyglot'
" syntastic 语法检测
Plug 'vim-syntastic/syntastic'
" 用于展示一个类似文件缩略图的东西
" 查看当前代码文件中的变量和函数列表的插件,
" 可以切换和跳转到代码中对应的变量和函数的位置
" 大纲式导航, Go 需要 https://github.com/jstemmer/gotags 支持
Plug 'majutsushi/tagbar'
" 自动补全括号的插件,包括小括号,中括号,以及花括号
Plug 'jiangmiao/auto-pairs'
" 自动补全
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
" git
" Plug 'tpope/vim-fugitive'
" vim-go
Plug 'fatih/vim-go', { 'tag': '*' }
Plug 'Blackrush/vim-gocode'
" go 中的代码追踪,输入 gd 就可以自动跳转
Plug 'dgryski/vim-godef'
" 模糊搜索 已经用了 ctrlp ,这里就不用 fzf 了
"Plug 'junegunn/fzf', { 'do': { -> fzf
" yaml prettier
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
call plug#end()
" ************************** my plugin end ************************
" ************************** my plugin end ************************
" ************************** my plugin end ************************
" ********************* plugin config start **************************
" ********************* plugin config start **************************
" ********************* plugin config start **************************
" ******* molokai config ******
colorscheme molokai
set t_Co=256
set background=dark
let g:molokai_original = 1
" ****** NERDTree config ******
autocmd vimenter * NERDTree " 自动开启
"let g:NERDTreeWinSize = 25 "设定 NERDTree 视窗大小
map <F2> :NERDTreeToggle<CR> " F2 开启/关闭 快捷键
"let NERDTreeShowBookmarks=1 " 开启Nerdtree时自动显示Bookmarks
" 打开 vim 时,没有文件自动打开 nerdTree
autocmd vimenter * if !argc()|NERDTree|endif
" 当 nerdTree 为剩下唯一窗口时,自动关闭
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" 设置树的显示图片
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
"let NERDTreeIgnore = ['\.pyc$'] " 过滤所有.pyc文件不显示
let g:NERDTreeShowLineNumbers=1 " 是否显示行号
let g:NERDTreeHidden=0 "不显示隐藏文件
"Making it prettier
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
" ****** Tagbar config ******
nmap <F3> :TagbarToggle<CR>
let g:tagbar_width=35
let g:tagbar_autofocus=1
let g:tagbar_left = 0 " 窗口位置 0右 1左
let g:Tlist_Ctags_Cmd='/usr/local/Cellar/ctags/5.8_1/bin/ctags'
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
" ********* autoformat ******
"F3自动格式化代码
noremap <C-l> :Autoformat<CR>
let g:autoformat_verbosemode=1
" ****** vim-go ******
let g:go_bin_path = $HOME.'/go/bin'
" ****** ycm *******
let g:syntastic_java_checkers = []
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
let g:ycm_semantic_triggers = {
\ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],
\ 'cs,lua,javascript': ['re!\w{2}'],
\ }
" ********************* plugin config end **************************
" ********************* plugin config end **************************
" ********************* plugin config end **************************
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'