"START =========================================================================
"set
syntax on
"color elflord ron industry pablo slate
colorscheme desert
let mapleader=' '
"set start
set number
set relativenumber
set cursorline
set hlsearch
set incsearch
set ignorecase
set smartcase
set mouse=a
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
" 设置字体
"set gfw=幼圆:h12:cGB2312
set autochdir
set listchars=tab:>-,trail:-
set list
"tab
set tabstop=4
set expandtab
set shiftwidth=4
set viminfo+=%
set showcmd
set wildmenu
"encoding
"set encoding=utf-8
"set fileencodings=ucs-bom,utf-8,cp936
"set fileencoding=gb2312
"set termencoding=utf-8
set fileencodings=ucs-bom,utf-8,utf-16,gbk,big5,gb18030,latin1
"set
"END ===========================================================================
"START =========================================================================
"map
imap jj <Esc>
noremap <LEADER><CR> :nohlsearch<CR>
noremap <LEADER>n :NERDTreeToggle<CR>
noremap <LEADER>w <C-w>w
noremap <LEADER>h <C-w>h
noremap <LEADER>j <C-w>j
noremap <LEADER>k <C-w>k
noremap <LEADER>l <C-w>l
noremap <LEADER>t :tabnext<CR>
noremap <LEADER>T :tabNext<CR>
"调整窗口大小快捷键
noremap <M-j> :res-1<CR>
noremap <M-k> :res+1<CR>
noremap <M-h> :vertical res-1<CR>
noremap <M-l> :vertical res+1<CR>
noremap <LEADER>s :set list<CR>
noremap <LEADER>ns :set nolist<CR>
noremap <LEADER>x :set expandtab<CR>
noremap <LEADER>nx :set noexpandtab<CR>
map mm <C-^>
"map
"END ===========================================================================
"START =========================================================================
"cmd
"autocmd VimEnter * NERDTree
"autocmd bufenter * NERDTree
autocmd GUIEnter * simalt ~X
"cmd
"END ===========================================================================
"START =========================================================================
"PlugInstall
call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'Yggdroot/LeaderF'
Plug 'BurntSushi/ripgrep'
"gutentags first,must install gtags and ctags
Plug 'ludovicchabant/vim-gutentags'
"Plug 'skywind3000/gutentags_plus'
Plug 'skywind3000/vim-preview'
Plug 'fholgado/minibufexpl.vim'
call plug#end()
"PlugInstall
"END ===========================================================================
"START =========================================================================
"config airline
"let g:airline_theme='dark'
"let g:airline#extensions#tabline#enabled=0
"END ===========================================================================
"START =========================================================================
"LeaderF
let g:Lf_RootMarkers = ['.froot', '.git', '.hg', '.svn' ]
let g:Lf_WorkingDirectoryMode = 'Ac'
"let g:Lf_UseCache=0 "After vim start, update cache when LeaderF first start F5 manually update
let g:Lf_Gtagslabel='new-ctags'
let g:Lf_Gtagsconf=expand('~\gtags.conf')
let g:Lf_CacheDirectory = expand('~/.cache/leaderf')
" 是否自动生成索引为LeaderF使用
" gtags 对大工程支出不友好,只有用ctags
let g:Lf_GtagsAutoGenerate=0
"LeaderF
"END ===========================================================================
"START =========================================================================
"gutentags plus
" change focus to quickfix window after search (optional).
let g:gutentags_plus_switch = 1
"gutentags plus
"END ===========================================================================
"START =========================================================================
"gutentags config
"path 0430
"let $GTAGSCONF = '~/gtags.conf'
" gutentags 搜索工程目录的标志,当前文件路径向上递归直到碰到这些文件/目录名
let g:gutentags_project_root = ['.root', '.svn', '.hg', '.project']
" 所生成的数据文件的名称
let g:gutentags_ctags_tagfile = '.tags'
" 同时开启 ctags 和 gtags 支持:
let g:gutentags_modules = []
if executable('ctags')
let g:gutentags_modules += ['ctags']
endif
"gtags can not support big project
if executable('gtags-cscope') && executable('gtags')
let g:gutentags_modules += ['gtags_cscope']
endif
" 将自动生成的 ctags/gtags 文件全部放入 ~/.cache/tags 目录中,避免污染工程目录
let g:gutentags_cache_dir = expand('~/.cache/tags')
" 配置 ctags 的参数,老的 Exuberant-ctags 不能有 --extra=+q,注意
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']
" 如果使用 universal ctags 需要增加下面一行,老的 Exuberant-ctags 不能加下一行
let g:gutentags_ctags_extra_args += ['--output-format=e-ctags']
"0 禁用 gutentags 自动加载 gtags 数据库的行为
let g:gutentags_auto_add_gtags_cscope = 1
"0430
"set cscopetag
set cscopeprg='gtags-cscope'
nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>:copen<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>:copen<CR>
nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>:copen<CR>
nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>:copen<CR>
nmap <C-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR>:copen<CR>
nmap <C-@>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>:copen<CR>
nmap <C-@>d :cs find d <C-R>=expand("<cword>")<CR><CR>:copen<CR>
" gutentags
"END ===========================================================================
"START =========================================================================
"Preview config
noremap <m-u> :PreviewScroll -1<cr>
noremap <m-d> :PreviewScroll +1<cr>
inoremap <m-u> <c-><c-o>:PreviewScroll -1<cr>
inoremap <m-d> <c-><c-o>:PreviewScroll +1<cr>
autocmd FileType qf nnoremap <silent><buffer> p :PreviewQuickfix<cr>
autocmd FileType qf nnoremap <silent><buffer> P :PreviewClose<cr>
"Preview
"END ===========================================================================
"START =========================================================================
"Minbuffer manager
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
let g:bufExplorerMaxHeight=60
let g:miniBufExplorerMoreThanOne=0
"MinBuffer
"END ===========================================================================