-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.vim
executable file
·807 lines (656 loc) · 18.9 KB
/
init.vim
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
syntax on
set noswapfile
set nocompatible
filetype off
filetype indent on
filetype plugin on
filetype plugin indent on
set mouse =a
set encoding =utf-8
let &t_ut=''
set expandtab
set tabstop =4
set shiftwidth =4
set softtabstop =4
set scrolloff=10
set tw=0
set ai! "Auto indent
set cindent
set ruler
set indentexpr=
set foldmethod=indent
set foldlevel=99
set laststatus=2
set conceallevel=0 "Markdown中*等符号的隐藏等级。0为不隐藏。3为全隐藏
set autochdir
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal!g'\"" | endif
"set guifont=Source_Code_Pro:h12
"set guioptions-=m
"set guioptions-=T
set fileencodings=utf-8,chinese,latin-1
let mapleader=" "
set number
set cursorline
set backspace=indent,eol,start
set wrap
set showcmd
set wildmenu
set hlsearch
set incsearch
exec "nohlsearch"
set ignorecase
set smartcase
set cursorcolumn
" 基于缩进或语法进行代码折叠
set foldmethod=indent
" set foldmethod=syntax 启动 vim 时关闭折叠代码
set nofoldenable
set showmatch
set shortmess=atI
set undofile
set undodir =~/.vim/undodir
au InsertLeave *.go write
mapclear
map Q :q<CR>
map S :w<CR>
nnoremap j h
nnoremap k j
nnoremap i k
nnoremap a i
nnoremap A a
nnoremap o I
nnoremap O A
nnoremap J 0
nnoremap K 5j
nnoremap I 5k
nnoremap L $
nnoremap Y p
nnoremap = nzz
nnoremap - Nzz
"inoremap ∆ <left>
"inoremap ¬ <right>
"inoremap ˆ <up>
"inoremap ˚ <down>
vnoremap I 5<Up>
vnoremap K 5<Down>
vnoremap L $
vnoremap J 0
vnoremap i <Up>
vnoremap j <Left>
vnoremap k <Down>
" Ctrl + U or E will move up/down the view port without moving the cursor
nnoremap <C-U> 5<C-y>
nnoremap <C-E> 5<C-e>
" cant work inoremap <C-U> <Esc>5<C-y>a
"inoremap <C-E> <Esc>5<C-e>a
" move cursor to center of window
imap <C-c> <Esc>zza
nmap <C-c> zz
" windows control
noremap <LEADER>wnl :set splitright<CR>:vsplit<CR>
noremap <LEADER>wni :set nosplitbelow<CR>:split<CR>
noremap <LEADER>wnk :set splitbelow<CR>:split<CR>
noremap <LEADER>wnj :set nosplitright<CR>:vsplit<CR>
map <LEADER>wl <C-w>l
map <LEADER>wj <C-w>h
map <LEADER>wi <C-w>k
map <LEADER>wk <C-w>j
map<LEADER>wrj :vertical resize-5<CR>
map<LEADER>wrl :vertical resize+5<CR>
map<LEADER>wri :res +5<CR>
map<LEADER>wrk :res -5<CR>
map<LEADER>wv <C-w>t<C-w>H
map<LEADER>wh <C-w>t<C-w>K
" tab control
"map<LEADER>tn :tabe<CR>
"map<LEADER>tj :-tabnext<CR>
"map<LEADER>tl :+tabnext<CR>
"map<LEADER>td :tanc<CR>
"map<LEADER>tL :tablast<CR>
"map<LEADER>tJ :tabfirst<CR>
map<LEADER><CR> :nohlsearch<Cr>
" Spelling Check
"map <LEADER>sc :set spell!<CR>
"noremap <C-x> ea<C-x>s
"inoremap <C-x> <Esc>ea<C-x>s
"man" 启用:Man命令查看各类man信息
"source $VIMRUNTIME/ftplugin/man.vim
"" 定义:Man命令查看各类man信息的快捷键
"nmap <Leader>man :Man 3 <cword><CR>
"function! g:BuffetSetCustomColors()
"hi! BuffetCurrentBuffer cterm=NONE ctermbg=5 ctermfg=8 guibg=#859900 guifg=#D3D3D3
"hi! BuffetActiveBuffer cterm=NONE ctermbg=10 ctermfg=2 guibg=#00BFFF guifg=#D3D3D3
"hi! BuffetBuffer cterm=NONE ctermbg=10 ctermfg=8 guibg=#676868 guifg=#DCDCDC
"hi! BuffetTrunc cterm=bold ctermbg=11 ctermfg=8 guibg=#999999 guifg=#000000
"hi! BuffetTab cterm=NONE ctermbg=4 ctermfg=8 guibg=#288BD3 guifg=#000000
"endfunction
set rtp+=~/.vim/bundle/Vundle.vim
"set rtp+=/usr/local/opt/fzf
call plug#begin('~/.vim/bundle')
"" pretty
"Plug 'VundleVim/Vundle.vim'
Plug 'vim-airline/vim-airline'
Plug 'connorholyday/vim-snazzy'
Plug 'dracula/vim'
Plug 'itchyny/vim-cursorword'
"Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
Plug 'vim-airline/vim-airline-themes'
" Plugin 'nathanaelkane/vim-indent-guides'
Plug 'Yggdroot/indentLine'
""Plugin 'fholgado/minibufexpl.vim'
Plug 'ryanoasis/vim-devicons'
"Plugin 'bagrat/vim-buffet'
Plug 'mhinz/vim-startify'
Plug 'altercation/vim-colors-solarized'
"Plug 'xolox/vim-session'
Plug 'deoplete-plugins/deoplete-clang'
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
""
""
""
""
"""nerdtree
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Xuyuanp/nerdtree-git-plugin'
""
"""tagbar
"Plug 'majutsushi/tagbar', { 'on': 'TagbarOpenAutoClose' }
Plug 'majutsushi/tagbar'
""
""" Error checking
"Plugin 'w0rp/ale'
""
""" ycm
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'fatih/vim-go', { 'tag': '*' }
"Plug 'dgryski/vim-godef'
"Plug 'neoclide/coc.nvim', {'branch': 'release'}
"Plugin 'Valloric/YouCompleteMe'
""
""" Undo Tree
Plug 'mbbill/undotree'
""
""" git
" 左边栏显示git信息
Plug 'mhinz/vim-signify'
Plug 'tpope/vim-fugitive'
""
" doxygen
"Plug 'vim-scripts/DoxygenToolkit.vim'
""
""" c++ highlight
"Plug 'octol/vim-cpp-enhanced-highlight'
"Plug 'STL-improved'
""
""
""" others
"Plug 'easymotion/vim-easymotion'
""
""
""
"""search
"Plug 'wsdjeg/FlyGrep.vim'
"Plug 'brooth/far.vim'
"Plug 'dyng/ctrlsf.vim'
"Plug 'mileszs/ack.vim'
""Plugin 'ctrlpvim/ctrlp.vim'
" Fast file navigation
""Plugin 'wincent/Command-T'
""
"""edit
"Plug 'terryma/vim-multiple-cursors'
Plug 'scrooloose/nerdcommenter'
"Plug 'SirVer/ultisnips'
"Plug 'honza/vim-snippets'
""Plugin 'derekwyatt/vim-protodef'
"Plug 'vim-scripts/h2cppx'
"Plug 'gcmt/wildfire.vim'
"Plug 'drmingdrmer/xptemplate'
Plug 'godlygeek/tabular'
Plug 'jiangmiao/auto-pairs'
Plug 'junegunn/fzf.vim'
" go 主要插件
"Plug 'fatih/vim-go', { 'tag': '*' }
" go 中的代码追踪,输入 gd 就可以自动跳转
"Plug 'dgryski/vim-godef'
Plug 'junegunn/vim-easy-align'
"colorscheme
Plug 'junegunn/seoul256.vim'
Plug 'yuttie/inkstained-vim'
Plug 'lifepillar/vim-solarized8'
Plug 'ayu-theme/ayu-vim'
Plug 'morhetz/gruvbox'
Plug 'w0ng/vim-hybrid'
"Plugin 'roxma/nvim-yarp'
"Plugin 'ncm2/ncm2'
"Plugin 'ncm2/ncm2-bufword'
"Plugin 'ncm2/ncm2-path'
"Plugin 'ncm2/ncm2-pyclang':
Plug 'voldikss/vim-codelf'
" go debug
"Plug 'sebdah/vim-delve'
"
"
"
"
"markdown
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
call plug#end()
"let g:delve_project_root = "/app/"
"set background=light
"colorscheme seoul256-light
"let ayucolor="dark" " for light version of theme
"colorscheme ayu
"colorscheme snazzy
"color dracula
color hybrid
"colorscheme gruvbox
highlight Pmenu ctermbg=darkGrey ctermfg=White
highlight PmenuSel ctermbg=darkblue ctermfg=White
let g:go_fmt_command = "golines"
let g:go_fmt_options = {
\ 'golines': '-m 128',
\ }
"verbose highlight Pmenu
"hi Pmenu ctermfg=NONE ctermbg=236 cterm=NONE guifg=NONE guibg=#64666d gui=NONE
"hi PmenuSel ctermfg=NONE ctermbg=24 cterm=NONE guifg=NONE guibg=#204a87 gui=NONE
"let g:gruvbox_contrast_dark="hard"
"Compile function
map r :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!clang++ -std=c++11 -stdlib=libc++ -Weverything % -o %<"
exec "!./%<"
elseif &filetype == 'cpp'
exec "!clang++ -std=c++11 -stdlib=libc++ -Weverything % -o %<"
exec "!./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!time java %<"
elseif &filetype == 'go'
exec "!go run %"
elseif &filetype == 'sh'
:!time bash %
elseif &filetype == 'python'
silent! exec "!clear"
exec "!time python3 %"
elseif &filetype == 'html'
exec "!firefox % &"
elseif &filetype == 'markdown'
exec "MarkdownPreview"
elseif &filetype == 'vimwiki'
exec "MarkdownPreview"
elseif &filetype == 'go'
set splitbelow
:sp
:term go run %
endif
endfunc
"inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
"inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
"let g:ncm2_pyclang#library_path = '/usr/local/Cellar/llvm/8.0.0_1/lib'
" enable ncm2 for all buffers
"autocmd BufEnter * call ncm2#enable_for_buffer()
"set completeopt=noinsert,menuone,noselect
" make it pretty
"colorscheme snazzy
"let g:SnazzyTransparent = 1
"colorscheme dracula
"let g:airline_theme='dracula'
let g:airline_theme='hybrid'
"let g:airline_theme='ayu_light'
"set transparency=15
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline#extensions#hunks#enabled=1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_symbols.notexists = ' ?'
let g:airline_symbols.dirty='⚡'
" ===
" " === NERDTree
" ===
map tt :NERDTreeToggle<CR>
let NERDTreeMapActivateNode = "l"
let NERDTreeMapOpenVSplit = "L"
let NERDTreeMapJumpParent = "j"
let NERDTreeMapJumpRoot = "J"
let NERDTreeMenuDown = "k"
let NERDTreeMenuUp = "i"
let NERDTreeMapJumpPrevSibling = "<C-i>"
let NERDTreeMapJumpNextSibling = "<C-k>"
let NERDTreeMapOpenSplit = ""
let NERDTreeMapJumpFirstChild = "gg"
let NERDTreeMapJumpLastChild = "G"
let NERDTreeMapToggleHidden = "H"
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"autocmd VimEnter * NERDTree
"autocmd VimEnter *
"\ if !argc()
"\ | Startify
"\ | NERDTree
""\ | wincmd w
"\ | endif
let NERDTreeMinimalMenu=1
let NERDTreeCascadeOpenSingleChildDir=1
let NERDTreeCascadeSingleChildDir=1
" 设置NERDTree子窗口宽度
let NERDTreeWinSize=32
" 设置NERDTree子窗口位置
let NERDTreeWinPos="left"
" 显示隐藏文件
let NERDTreeShowHidden=1
" NERDTree 子窗口中不显示冗余帮助信息
let NERDTreeMinimalUI=1
" 删除文件时自动删除文件对应 buffer
let NERDTreeAutoDeleteBuffer=1
" ===
" === vim-indent-guide
" ===
"let g:indent_guides_guide_size = 1
"let g:indent_guides_start_level = 2
"let g:indent_guides_enable_on_vim_startup = 1
"let g:indent_guides_color_change_percent = 1
" autocmd VimEnter * silent NERDTree | wincmd p
" ==
" == NERDTree-git
" ==
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ "Unknown" : "?"
\ }
"" ===
"" === coc
"" ===
" use <tab> for trigger completion and navigate to the next complete item
"
"
"
"自动修复import
"autocmd BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport')
"
"" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
let g:go_def_mapping_enabled = 0
let g:go_textobj_enabled = 0
nmap gd :GoDef<CR>
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
"" fix the most annoying bug that coc has
"silent! au BufEnter,BufRead,BufNewFile * silent! unmap if
"let g:coc_global_extensions = ['coc-python', 'coc-vimlsp', 'coc-emmet', 'coc-html', 'coc-json', 'coc-css', 'coc-tsserver', 'coc-yank', 'coc-lists', 'coc-gitignore', 'coc-go']
"set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
"" use <tab> for trigger completion and navigate to the next complete item
"function! s:check_back_space() abort
"let col = col('.') - 1
"return !col || getline('.')[col - 1] =~ '\s'
"endfunction
"inoremap <silent><expr> <Tab>
"\ pumvisible() ? "\<C-n>" :
"\ <SID>check_back_space() ? "\<Tab>" :
"\ coc#refresh()
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <silent><expr> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use H to show documentation in preview window
nnoremap <silent> H :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" if hidden is not set, TextEdit might fail.
set hidden
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" tagbar
" 设置 tagbar 子窗口的位置出现在主编辑区的左边
let tagbar_left=0
" 设置显示/隐藏标签列表子窗口的快捷键。速记:identifier list by tag
nnoremap <Leader>tb :TagbarToggle<CR>
" 设置标签子窗口的宽度
let tagbar_width=32
" tagbar 子窗口中不显示冗余帮助信息
let g:tagbar_compact=1
" 设置 ctags 对哪些代码标识符生成标签
" tagbar
let g:tagbar_map_showproto = ""
let g:tagbar_map_togglecaseinsensitive = ""
let g:tagbar_map_togglefold = "j"
let g:tagbar_map_preview = "l"
let g:tagbar_map_jump = "L"
let g:tagbar_map_openallfolds = "="
let g:tagbar_map_closeallfolds = "-"
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'
\ }
" search
"nnoremap <LEADER>s :CtrlSF
"
" none\done\start
" done within 1000ms will focus
"let g:ctrlsf_auto_focus = {
"\ "at" : "done",
"\ "duration_less_than": 1000
"\ }
"let g:ctrlsf_mapping = {
"\ "open" : ["<CR>", "L"],
"\ "openb" : "O",
"\ "split" : "<C-O>",
"\ "vsplit" : "",
"\ "tab" : "t",
"\ "tabb" : "T",
"\ "popen" : "l",
"\ "popenf" : "P",
"\ "quit" : "q",
"\ "next" : "k",
"\ "prev" : "i",
"\ "pquit" : "q",
"\ "loclist" : "",
"\ "chgmode" : "M",
"\ "stop" : "<C-C>",
"\ }
"edit
"
"
""
"let g:multi_cursor_use_default_mapping=0
"" Default mapping
"let g:multi_cursor_start_word_key = '<C-n>'
"let g:multi_cursor_select_all_word_key = '<A-n>'
"let g:multi_cursor_start_key = 'g<C-n>'
"let g:multi_cursor_select_all_key = 'g<A-n>'
"let g:multi_cursor_next_key = '<C-n>'
"let g:multi_cursor_prev_key = '<C-p>'
"let g:multi_cursor_skip_key = '<C-m>'
"let g:multi_cursor_quit_key = '<Esc>'
"let g:ctrlsf_default_root = 'project'
" 替换函数。参数说明:
" confirm:是否替换前逐一确认
" wholeword:是否整词匹配
" replace:被替换字符串
"function! Replace(confirm, wholeword, replace)
"wa
"let flag = ''
"if a:confirm
"let flag .= 'gec'
"else
"let flag .= 'ge'
"endif
"let search = ''
"if a:wholeword
"let search .= '\<' . escape(expand('<cword>'), '/\.*$^~[') . '\>'
"else
"let search .= expand('<cword>')
"endif
"let replace = escape(a:replace, '/\&~')
"execute 'argdo %s/' . search . '/' . replace . '/' . flag . '| update'
"endfunction
"" 不确认、非整词
"nnoremap <Leader>rCW :call Replace(0, 0, input('Replace '.expand('<cword>').' with: '))<CR>
"" 不确认、整词
"nnoremap <Leader>rCw :call Replace(0, 1, input('Replace '.expand('<cword>').' with: '))<CR>
"" 确认、非整词
"nnoremap <Leader>rcW :call Replace(1, 0, input('Replace '.expand('<cword>').' with: '))<CR>
"" 确认、整词
"nnoremap <Leader>rcw :call Replace(1, 1, input('Replace '.expand('<cword>').' with: '))<CR>
" ultisnips 模板补全
"let g:UltiSnipsSnippetDirectories=["mysnippets"]
" UltiSnips 的 tab 键与 YCM 冲突,重新设定
"let g:UltiSnipsExpandTrigger="<C-f>"
""接口转实现"
"let g:h2cppx_python_path = '/usr/bin/python2.7'
"nmap <F3> :H2cppx<ESC>
"nmap <F4> :H2cppxLine<ESC>
"buffer switch"
nmap <leader>1 :b1<CR>
nmap <leader>2 :b2<CR>
nmap <leader>3 :b3<CR>
nmap <leader>4 :b4<CR>
nmap <leader>5 :b5<CR>
nmap <leader>6 :b6<CR>
nmap <leader>7 :b7<CR>
nmap <leader>8 :b8<CR>
nmap <leader>9 :b9<CR>
nmap <leader>0 :b10<CR>
nnoremap <Tab> :bn<CR>
nnoremap <S-Tab> :bp<CR>
nnoremap <C-X> :bdelete<CR>
"fast visual"
" 快捷键
"map h <Plug>(wildfire-fuel)
"vmap ; <Plug>(wildfire-water)
"" 适用于哪些结对符
"let g:wildfire_objects = ["i'", 'i"', "i)", "i]", "i}", "i>", "ip"]
"undotree"
nnoremap <F5> :UndotreeToggle<cr>
"ctrlp"
"" 打开ctrlp搜索
"let g:ctrlp_map = '<leader>ff'
"let g:ctrlp_cmd = 'CtrlP'
"" 相当于mru功能,show recently opened files
"map <leader>fp :CtrlPMRU<CR>
"set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux"
"let g:ctrlp_custom_ignore = {
"\ 'dir': '\v[\/]\.(git|hg|svn|rvm)$',
"\ 'file': '\v\.(exe|so|dll|zip|tar|tar.gz)$',
"\ }
""""\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
"let g:ctrlp_working_path_mode=0
"let g:ctrlp_match_window_bottom=1
"let g:ctrlp_max_height=15
"let g:ctrlp_match_window_reversed=0
"let g:ctrlp_mruf_max=500
"let g:ctrlp_follow_symlinks=1
""xptemplate"
"let g:xptemplate_vars = "BRfun= "
"let g:xptemplate_vars = "BRif= "
"markdown
"
" set to 1, nvim will open the preview window after entering the markdown buffer
" default: 0
"let g:mkdp_auto_start = 0
" easymotion
"
nmap s <Plug>(easymotion-s2)
" vim-go
let g:go_doc_keywordprg_enabled = 0
let g:go_fmt_command = "goimports" " 格式化將預設的 gofmt 替換
let g:go_autodetect_gopath = 1
let g:go_list_type = "quickfix"
let g:go_auto_type_info = 1
let g:go_gopls_complete_unimported = 1
let g:go_version_warning = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_methods = 1
let g:go_highlight_generate_tags = 1
let g:godef_split=2
"let g:go_debug=['shell-commands']
" startify
let g:startify_bookmarks = [ {'c': '~/.vimrc'}, '~/.zshrc' ]
let g:startify_change_to_vcs_root = 1
"let g:startify_session_persistence = 1
let g:startify_lists = [
\ { 'type': 'dir', 'header': [' Recent files'] },
\ { 'type': 'sessions', 'header': [' Saved sessions'] },
\ ]
"if has('nvim')
"autocmd TabNewEntered * Startify
"else
"autocmd BufWinEnter *
"\ if !exists('t:startify_new_tab')
"\ && empty(expand('%'))
"\ && empty(&l:buftype)
"\ && &l:modifiable |
"\ let t:startify_new_tab = 1 |
"\ Startify |
"\ endif
"endif
let g:vim_markdown_conceal = 0