Last active
March 13, 2018 16:09
-
-
Save ijingo/61366988e2ee9c8b2d35eda16eb03b4f to your computer and use it in GitHub Desktop.
.vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 | |
set fileencoding=utf-8 | |
set encoding=utf-8 | |
set termencoding=utf-8 | |
set guifont=Inconsolata\ for\ Powerline:h14 | |
" <Leader> key | |
let mapleader=";" | |
syntax enable | |
syntax on | |
set mouse=a | |
" Vundel initialization | |
set nocompatible " be iMproved, required | |
filetype off " required | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'szw/vim-tags' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Bundle 'octol/vim-cpp-enhanced-highlight' | |
" Bundle 'sheerun/vim-polyglot' | |
" Bundle 'nathanaelkane/vim-indent-guides' | |
" swtich between header and source file | |
" Bundle 'derekwyatt/vim-fswitch' | |
Bundle 'kshenoy/vim-signature' | |
" display git diff / stages / undoes | |
Bundle 'airblade/vim-gitgutter' | |
" highlight lines with mark | |
"Bundle 'vim-scripts/BOOKMARKS--Mark-and-Highlight-Full-Lines' | |
Bundle 'majutsushi/tagbar' | |
" should install together | |
" Plugin 'vim-scripts/indexer.tar.gz' | |
" Plugin 'vim-scripts/DfrankUtil' | |
" Plugin 'vim-scripts/vimprj' | |
" selecet context with <> [] {} | |
" Bundle 'gcmt/wildfire.vim' | |
" Bundle 'othree/xml.vim' | |
Plugin 'gmarik/Vundle.vim' | |
Bundle 'Valloric/YouCompleteMe' | |
Plugin 'scrooloose/nerdtree' | |
" Bundle 'derekwyatt/vim-scala' | |
" Plugin 'Lokaltog/powerline-fonts' | |
" Bundle 'scrooloose/nerdcommenter' | |
" Plugin 'sjl/gundo.vim' | |
" Bundle 'mbbill/undotree' | |
" Plugin 'terryma/vim-multiple-cursors' | |
Plugin 'rhysd/vim-clang-format' | |
" Plugin 'fatih/vim-go' | |
Plugin 'Lokaltog/vim-easymotion' | |
" Plugin 'tomlion/vim-solidity' | |
" Bundle 'derekwyatt/vim-protodef' | |
call vundle#end() | |
filetype plugin indent on | |
" Plug 'majutsushi/tagbar' | |
let tagbar_right=1 | |
let tagbar_width=96 | |
let g:tagbar_compact=1 | |
" Go tags | |
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', } | |
" YouCompleteMe Settings | |
let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py" | |
" 补全功能在注释中同样有效 | |
let g:ycm_complete_in_comments=1 | |
" 开启 YCM 标签补全引擎 | |
let g:ycm_collect_identifiers_from_tags_files=0 | |
" YCM 集成 OmniCppComplete 补全引擎,设置其快捷键 | |
inoremap <leader>; <C-x><C-o> | |
" 补全内容不以分割子窗口形式出现,只显示补全列表 | |
set completeopt-=preview | |
" 禁止缓存匹配项,每次都重新生成匹配项 | |
let g:ycm_cache_omnifunc=1 | |
" 语法关键字补全 | |
let g:ycm_seed_identifiers_with_syntax=1 | |
let g:ycm_collect_identifiers_from_tags_files = 1 | |
" nerdcommenter Settings | |
let g:NERDSpaceDelims=1 | |
" indexer ctags settings | |
let g:indexer_ctagsCommandLineOptions="--c++-kinds=+p+l+x+c+d+e+f+g+m+n+s+t+u+v --fields=+iaSl --extra=+q" | |
" 正向遍历同名标签 | |
nmap <Leader>tn :tnext<CR> | |
" 反向遍历同名标签 | |
nmap <Leader>tp :tprevious<CR> | |
" 基于语义的代码导航 | |
nnoremap <leader>jc :YcmCompleter GoToDeclaration<CR> | |
" 只能是 #include 或已打开的文件 | |
nnoremap <leader>jd :YcmCompleter GoToDefinition<CR> | |
" map to <Leader>cf in C++ code" | |
autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR> | |
autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR> | |
" autocmd FileType c,cpp ClangFormatAutoEnable | |
" Toggle auto formatting:" | |
nmap <Leader>C :ClangFormatAutoToggle<CR> | |
" tarbar | |
let g:tarbar_autofocus = 1 | |
" vim-easymotion | |
let g:EasyMotion_smartcase = 1 | |
let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion | |
" enable powerline-fonts | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#left_sep = ' ' | |
let g:airline#extensions#tabline#left_alt_sep = '|' | |
let g:airline_powerline_fonts = 1 | |
let g:airline_theme='jellybeans' | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
" vim-indent-guides | |
" let g:indent_guides_enable_on_vim_startup=1 | |
" let g:indent_guides_start_level=2 | |
" let g:indent_guides_guide_size=1 | |
" nmap <silent> <Leader>i <Plug>IndentGuidesToggle | |
" Plug 'derekwyatt/vim-fswitch' | |
nmap <silent> <Leader>sw :FSHere<cr> | |
" nerdtree | |
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) | |
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg | |
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' | |
endfunction | |
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') | |
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') | |
call NERDTreeHighlightFile('yml', 'magenta', 'none', 'yellow', '#E70350') | |
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('html', 'green', 'none', 'green', '#04E703') | |
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') | |
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') | |
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') | |
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') | |
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') | |
let NERDTreeShowHidden=1 | |
let NERDTreeAutoDeleteBuffer=1 | |
" Plug 'kshenoy/vim-signature' | |
" let g:SignatureMap = { | |
" \ 'Leader' : "m", | |
" \ 'PlaceNextMark' : "m,", | |
" \ 'ToggleMarkAtLine' : "m.", | |
" \ 'PurgeMarksAtLine' : "m-", | |
" \ 'DeleteMark' : "dm", | |
" \ 'PurgeMarks' : "mda", | |
" \ 'PurgeMarkers' : "m<BS>", | |
" \ 'GotoNextLineAlpha' : "']", | |
" \ 'GotoPrevLineAlpha' : "'[", | |
" \ 'GotoNextSpotAlpha' : "`]", | |
" \ 'GotoPrevSpotAlpha' : "`[", | |
" \ 'GotoNextLineByPos' : "]'", | |
" \ 'GotoPrevLineByPos' : "['", | |
" \ 'GotoNextSpotByPos' : "mn", | |
" \ 'GotoPrevSpotByPos' : "mp", | |
" \ 'GotoNextMarker' : "[+", | |
" \ 'GotoPrevMarker' : "[-", | |
" \ 'GotoNextMarkerAny' : "]=", | |
" \ 'GotoPrevMarkerAny' : "[=", | |
" \ 'ListLocalMarks' : "ms", | |
" \ 'ListLocalMarkers' : "m?" | |
" \ } | |
" | |
" status bar always on | |
set laststatus=2 | |
" position of cursor | |
set ruler | |
" line number | |
set number | |
set cursorline | |
set cursorcolumn | |
set autoindent | |
set smartindent | |
set cindent | |
set showmatch | |
set shiftround | |
set hlsearch | |
set incsearch " real-time search | |
set wildmenu " auto-complete for vim command | |
set nofoldenable | |
set foldmethod=indent | |
set backspace=indent,eol,start | |
set expandtab | |
" spaces when editing | |
set tabstop=4 | |
" spaces when formatting | |
set shiftwidth=4 | |
" vim regard consecutive spaces as one tab | |
set softtabstop=4 | |
" colorscheme: solarized | |
colorscheme solarized | |
set t_Co=256 | |
set background=dark | |
" Customed Hotkey | |
vnoremap <Leader>y "+y " yank to system pasteboard | |
nmap <Leader>p "+p " paste from system pasteboard | |
nnoremap nw <C-W><C-W> " change window sequentially | |
nnoremap <Leader>wh <C-W>h | |
nnoremap <Leader>wj <C-W>j | |
nnoremap <Leader>wk <C-W>k | |
nnoremap <Leader>wl <C-W>l nmap <Leader>j $a;<NL> | |
nmap <Leader>j $a;<CR> | |
nmap <F4> :set hlsearch! hlsearch?<CR> | |
nnoremap <F5> :NERDTreeToggle<CR> | |
nmap <F8> :TagbarToggle<CR> | |
vnoremap <leader>y "+y | |
nmap <leader>p "+p | |
nmap <Leader><leader>h <Plug>(easymotion-linebackward) | |
nmap <Leader><Leader>j <Plug>(easymotion-j) | |
nmap <Leader><Leader>k <Plug>(easymotion-k) | |
nmap <Leader><leader>l <Plug>(easymotion-lineforward) | |
nmap <Leader><leader>. <Plug>(easymotion-repeat) | |
" 快捷键 | |
map <SPACE> <Plug>(wildfire-fuel) | |
" vmap <C-SPACE> <Plug>(wildfire-water) | |
" 适用于哪些结对符 | |
let g:wildfire_objects = ["i'", 'i"', "i)", "i]", "i}", "i>", "ip"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment