1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
| " 插件管理vim-plug " ******************************BEGIN****************************** call plug#begin('~/.vim/plugged')
" ******************************外观****************************** "vim-colorschemes Plug 'flazz/vim-colorschemes' "change scheme Plug 'chxuan/change-colorscheme' "vim start page Plug 'mhinz/vim-startify'
" ******************************状态栏****************************** "vim-airline Plug 'vim-airline/vim-airline' "vim-airline themes Plug 'vim-airline/vim-airline-themes'
" *****************************侧边栏******************************* " nerdtree Plug 'scrooloose/nerdtree',{'on':'NERDTreeToggle'} "nerdtree-git-plugin Plug 'Xuyuanp/nerdtree-git-plugin' "tarbar Plug 'majutsushi/tagbar'
" *****************************快速配对******************************* "vim auto pair Plug 'jiangmiao/auto-pairs' "彩虹括号增强 Plug 'luochen1990/rainbow' "vim-endwise Plug 'tpope/vim-endwise'
" *****************************快速定位******************************* "fzf Plug 'junegunn/fzf', { 'dir': '~/.fzf'} "incsearch Plug 'haya14busa/incsearch.vim' "强化f/t Plug 'rhysd/clever-f.vim' "vim-easymotion Plug 'easymotion/vim-easymotion' "vim-surround Plug 'tpope/vim-surround'
" *****************************快速选择******************************* "vim expand region Plug 'terryma/vim-expand-region'
" *****************************编程相关******************************* "Git相关 Plug 'tpope/vim-fugitive' Plug 'junegunn/gv.vim' "Python Plug 'davidhalter/jedi-vim'
" *****************************注释******************************* "vim-commentary Plug 'tpope/vim-commentary'
" *****************************其它******************************* "对齐插件 Plug 'godlygeek/tabular' "buffer插件 Plug 'chxuan/vim-buffer' call plug#end() " ******************************END******************************
" 安装、更新、删除插件 nnoremap <leader><leader>i :PlugInstall<cr> nnoremap <leader><leader>u :PlugUpdate<cr> nnoremap <leader><leader>c :PlugClean<cr>
" ******************************外观****************************** "vim-colorschemes "默认主题 colorscheme 0x7A69_dark
"change-colorscheme nnoremap <silent> <F9> :PreviousColorScheme<cr> inoremap <silent> <F9> <esc> :PreviousColorScheme<cr> nnoremap <silent> <F10> :NextColorScheme<cr> inoremap <silent> <F10> <esc> :NextColorScheme<cr> nnoremap <silent> <F11> :RandomColorScheme<cr> inoremap <silent> <F11> <esc> :RandomColorScheme<cr> nnoremap <silent> <F12> :ShowColorScheme<cr> inoremap <silent> <F12> <esc> :ShowColorScheme<cr>
" ******************************状态栏****************************** "vim-airline let g:airline_theme="onedark" let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 if !exists('g:airline_symbols') let g:airline_symbols = {} endif let g:airline_section_b='%{strftime("%c")}' "使用时显示当前时间
" *****************************侧边栏******************************* "nerdtree "close vim if only nerdtree autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif "open nerdtree automatically when vim starts with a dictory autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif "快捷键 map <leader>n :NERDTreeToggle<cr> let g:NERDTreeDirArrowExpandable = '▸' let g:NERDTreeDirArrowCollapsible = '▾'
"nerdtree-git-plugin let g:NERDTreeIndicatorMapCustom = { \ "Modified" : "✹", \ "Staged" : "✚", \ "Untracked" : "✭", \ "Renamed" : "➜", \ "Unmerged" : "═", \ "Deleted" : "✖", \ "Dirty" : "✗", \ "Clean" : "✔︎", \ 'Ignored' : '☒', \ "Unknown" : "?" \ } "tarbar let g:tagbar_ctags_bin = 'ctags' let g:tagbar_width = 30 nnoremap <silent> <leader>t :TagbarToggle<cr> inoremap <silent> <leader>t <esc> :TagbarToggle<cr>
" *****************************快速定位******************************* "incsearch.vim map / <Plug>(incsearch-forward) map ? <Plug>(incsearch-backward) map g/ <Plug>(incsearch-stay) let g:incsearch#auto_nohlsearch = 1 map n <Plug>(incsearch-nohl-n) map N <Plug>(incsearch-nohl-N) map * <Plug>(incsearch-nohl-*) map # <Plug>(incsearch-nohl-#) map g* <Plug>(incsearch-nohl-g*) map g# <Plug>(incsearch-nohl-g#) "使用<Esc><Esc>暂时关闭高亮功能 nnoremap <Esc><Esc> :<C-u>nohlsearch<CR>
"f/t增强 let g:clever_f_ignore_case=1 let g:clever_f_smart_case=1 map ; <Plug>(clever-f-repeat-forward) map ' <Plug>(clever-f-repeat-back) "vim-easymotion let g:EasyMotion_smartcase=1 map <leader>w <Plug>(easymotion-bd-w) nmap <leader>w <Plug>(easymotion-overwin-w) map <leader>f <Plug>(easymotion-bd-f) nmap <leader>f <Plug>(easymotion-overwin-f) nmap <leader>s <Plug>(easymotion-overwin-f2) " Move to line map <Leader>j <Plug>(easymotion-bd-jk) nmap <Leader>j <Plug>(easymotion-overwin-line)
"fzf settings nnoremap <Tab> :FZF <cr> function! s:build_quickfix_list(lines) call setqflist(map(copy(a:lines), '{ "filename": v:val }')) copen cc endfunction let g:fzf_action = { \ 'ctrl-q': function('s:build_quickfix_list'), \ 'ctrl-t': 'tab split', \ 'ctrl-x': 'split', \ 'ctrl-v': 'vsplit' } "Default fzf layout let g:fzf_layout = { 'down': '~40%' } let g:fzf_colors = \ { 'fg': ['fg', 'Normal'], \ 'bg': ['bg', 'Normal'], \ 'hl': ['fg', 'Comment'], \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'Statement'], \ 'info': ['fg', 'PreProc'], \ 'border': ['fg', 'Ignore'], \ 'prompt': ['fg', 'Conditional'], \ 'pointer': ['fg', 'Exception'], \ 'marker': ['fg', 'Keyword'], \ 'spinner': ['fg', 'Label'], \ 'header': ['fg', 'Comment'] }
" *****************************快速选择******************************* "expand region expand map K <Plug>(expand_region_expand) map J <Plug>(expand_region_shrink) let g:expand_region_text_objects = { \ 'iw' :0, \ 'iW' :0, \ 'i"' :0, \ 'i''' :0, \ 'i]' :1, \ 'ib' :1, \ 'iB' :1, \ 'il' :0, \ 'ip' :1, \ 'ie' :0, \ }"
" *****************************编程相关*******************************" "git commit browser:vim-fugitive and gv "open commit browser nnoremap <leader>g :GV<cr> "will only list commits that affected the current file nnoremap <leader>G :GV!<cr> "fills the location list with the revisions of the current file nnoremap <leader>gg :GV?<cr>
"tpope/vim-fugitive nnoremap <leader>gd :Gdiff<cr> nnoremap <leader>gb :Gblame<cr> nnoremap <leader>gm :Gmove<cr> nnoremap <leader>gc :Gcommit -a <cr> nnoremap <leader>gs :Gstatus<cr> nnoremap <leader>gp :Gpush<cr>
" vim-gitgutter " gitgutter customise symbols let g:gitgutter_sign_added = 'A' let g:gitgutter_sign_modified = 'M' let g:gitgutter_sign_removed = 'D' let g:gitgutter_sign_removed_first_line = '^' let g:gitgutter_sign_modified_removed = 'W' " gitgutter mappings nmap ]h <Plug>GitGutterNextHunk nmap [h <Plug>GitGutterPrevHunk nmap <Leader>hv <Plug>GitGutterPreviewHunk " stage, and undo hunks with <leader>hs, and <leader>hu nnoremap <leader>go :GitGutterLineHighlightsEnable<cr> nnoremap <leader>gf :GitGutterLineHighlightsDisable<cr> nnoremap <leader>gt :GitGutterLineHighlightsToggle<cr>
" *****************************快速配对******************************* "彩虹括号增强 let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
" *****************************其它******************************* " vim-buffer nnoremap <silent> <c-p> :PreviousBuffer<cr> nnoremap <silent> <c-n> :NextBuffer<cr> nnoremap <silent> <leader>d :CloseBuffer<cr> nnoremap <silent> <leader>D :BufOnly<cr>
|