vim config
修改 vimrc 文件后执行 :PlugInstall
,安装对应的插件
" 0. plug pack: https://files.cnblogs.com/files/jiahu-Blog/vim_config.zip
" 1. git && clang-format is need
" 1. ubuntu: apt install clang-format-3.9
" 2. mac: brew install clang-format
" 2. vim verson must larger than 8.0
" 3. copy plug.vim into ~/.vim/autoload/
" 1. https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" 2. in vim execute: PlugInstall
" 4. universal-ctags
" 1. https://github.com/universal-ctags/ctags.git
" 2. sudo apt-get install autoconf
" 3. ./autogen.sh && ./configure && make && make install
" 5. solarized
" 1. https://github.com/altercation/vim-colors-solarized
set nocompatible " nocompat with vi
set encoding=utf-8
set t_Co=256
" vim-plug
call plug#begin()
Plug 'preservim/nerdtree' " dir tree
Plug 'vim-airline/vim-airline' " bottom line
Plug 'easymotion/vim-easymotion'
Plug 'kana/vim-fakeclip'
Plug 'vim-scripts/a.vim' " src && header switch
Plug 'rhysd/vim-clang-format' " clang-format is needed
Plug 'altercation/vim-colors-solarized'
Plug 'Yilin-Yang/vim-markbar' " vim marker helper
Plug 'vim-scripts/taglist.vim'
" Plug 'frazrepo/vim-rainbow'
call plug#end()
" clang-format
" https://clang.llvm.org/docs/ClangFormatStyleOptions.html
let g:clang_format#code_style = 'chromium' " llvm, google, chromium, mozilla
let g:clang_format#style_options = {
\ "AccessModifierOffset" : -4,
\ "AllowShortIfStatementsOnASingleLine" : "true",
\ "ColumnLimit" : 97,
\ "ContinuationIndentWidth" : 16,
\ "Standard" : "C++11"}
autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR>
autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
" color
syntax enable
let g:solarized_termtrans=1
let g:solarized_termcolors=256
set background=dark
colorscheme solarized
" colorscheme gruvbox
" change the color of easymotion
hi EasyMotionTarget ctermbg=none ctermfg=green
hi EasyMotionShade ctermbg=none ctermfg=blue
hi EasyMotionTarget2First ctermbg=none ctermfg=red
hi EasyMotionTarget2Second ctermbg=none ctermfg=lightred
" self config
set colorcolumn=99
set foldmethod=syntax
set smartindent
set expandtab
set ts=4 sw=4
set list
set lcs=tab:\|→,space:·
set lcs=tab:\|→
set number
set timeoutlen=500
set ttimeoutlen=100
" self keys mapping
let mapleader=','
" nerdtree
noremap <leader>nn :NERDTreeToggle<cr>
noremap <leader>nr :NERDTreeRefreshRoot<cr>
noremap <leader>nf :NERDTreeFind<cr>
" ctags
noremap <leader>cc :!ctags -R<cr>
" a.vim
noremap <leader>sw :A<cr>
noremap <leader>sv :AV<cr>
noremap <leader>sf :IH<cr>
" Tlist
noremap <leader>tl :Tlist<cr>
let Tlist_WinWidth = 37
" page down and up
noremap <leader>j <c-d>
noremap <leader>k <c-u>
" job stop
noremap <leader>z <c-z>
" vim-rainbow
let g:rainbow_active = 1
" terminal in vim8
noremap <leader>tt :term<cr>
" vim-marked-tab
nmap <leader>m <Plug>ToggleMarkbar
let g:markbar_marks_to_display = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
let g:markbar_width = 79
let g:markbar_peekaboo_width = 79
let g:markbar_context_indent_block = ' '
let g:markbar_num_lines_context = 0
let g:markbar_file_mark_format_string = '%9s'
let g:markbar_file_mark_arguments = ['fname']
" others
noremap <leader>v :vsp<cr>
noremap <c-h> <c-w><c-h>
noremap <c-j> <c-w><c-j>
noremap <c-k> <c-w><c-k>
noremap <c-l> <c-w><c-l>