@@ -260,11 +260,11 @@ Plug 'Xuyuanp/nerdtree-git-plugin'
260
260
Plug ' majutsushi/tagbar'
261
261
Plug ' junegunn/fzf' , { ' do' : { - > fzf#install () } }
262
262
Plug ' junegunn/fzf.vim'
263
- Plug ' SirVer/ultisnips'
264
263
Plug ' gergap/vim-snippets'
265
264
" install yarn using `sudo npm install --global yarn`
266
- Plug ' neoclide/coc.nvim' , {' branch' : ' release' , ' do' : ' yarn install --frozen-lockfile' }
267
- Plug ' jackguo380/vim-lsp-cxx-highlight'
265
+ Plug ' neoclide/coc.nvim' , {' branch' : ' release' }
266
+ " Plug 'neoclide/coc.nvim', {'branch': 'release', 'do': 'yarn install --frozen-lockfile'}
267
+ " Plug 'jackguo380/vim-lsp-cxx-highlight'
268
268
Plug ' vim-scripts/valgrind.vim'
269
269
Plug ' vim-scripts/a.vim'
270
270
" Plug 'vim-syntastic/syntastic'
@@ -513,51 +513,36 @@ let g:AutoClosePumvisible = {"ENTER": "<C-Y>", "ESC": "<ESC>"}
513
513
" which conflicts with Vim abbreviation
514
514
let g: AutoCloseExpandSpace = 0
515
515
516
- " ====[ UltiSnips plugin ]================================================
517
- let g: UltiSnipsExpandTrigger = " <tab>"
518
- let g: UltiSnipsListSnippets = " <c-tab>"
519
- let g: UltiSnipsJumpForwardTrigger = " <c-j>"
520
- let g: UltiSnipsJumpBackwardTrigger = " <c-k>"
521
- let g: UltiSnipsEditSplit = " horizontal"
522
- let g: UltiSnipsSnippetDirectories = [' ~/.vim/UltiSnips' , ' UltiSnips' ]
523
- inoremap <c-x><c-k> <c-x><c-k>
524
-
525
- function ! g: UltiSnips_Complete ()
526
- call UltiSnips#ExpandSnippet ()
527
- if g: ulti_expand_res == 0
528
- if pumvisible ()
529
- return " \<C-n> "
530
- else
531
- call UltiSnips#JumpForwards ()
532
- if g: ulti_jump_forwards_res == 0
533
- return " \<TAB> "
534
- endif
535
- endif
536
- endif
537
- return " "
538
- endfunction
516
+ " ====[ coc-snippets plugin ]================================================
517
+ " Use <C-l> for trigger snippet expand.
518
+ imap <C-l> <Plug> (coc-snippets-expand)
539
519
540
- function ! g: UltiSnips_Reverse ()
541
- call UltiSnips#JumpBackwards ()
542
- if g: ulti_jump_backwards_res == 0
543
- return " \<C-P> "
544
- endif
520
+ " Use <C-j> for select text for visual placeholder of snippet.
521
+ vmap <C-j> <Plug> (coc-snippets-select)
545
522
546
- return " "
547
- endfunction
523
+ " Use <C-j> for jump to next placeholder, it's default of coc.nvim
524
+ let g: coc_snippet_next = ' <c-j> '
548
525
526
+ " Use <C-k> for jump to previous placeholder, it's default of coc.nvim
527
+ let g: coc_snippet_prev = ' <c-k>'
549
528
550
- " if !exists("g:UltiSnipsJumpForwardTrigger" )
551
- " let g:UltiSnipsJumpForwardTrigger = "<tab>"
552
- " endif
553
- "
554
- " if !exists("g:UltiSnipsJumpBackwardTrigger" )
555
- " let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
556
- " endif
557
- "
558
- " au InsertEnter * exec "inoremap <silent> ".g:UltiSnipsExpandTrigger." <C-R>=g:UltiSnips_Complete()<cr>"
559
- " au InsertEnter * exec "inoremap <silent> ".g:UltiSnipsJumpBackwardTrigger." <C-R>=g:UltiSnips_Reverse()<cr>"
529
+ " Use <C-j> for both expand and jump (make expand higher priority. )
530
+ imap <C-j> <Plug> (coc-snippets-expand-jump)
531
+
532
+ " Use <leader>x for convert visual selected code to snippet
533
+ xmap <leader> x <Plug> (coc-convert-snippet )
534
+ inoremap <silent> <expr> <TAB>
535
+ \ coc#pum#visible() ? coc#_select_confirm() :
536
+ \ coc#expandableOrJumpable() ? "\ <C-r> =coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\ <CR> " :
537
+ \ CheckBackspace() ? "\ <TAB> " :
538
+ \ coc#refresh()
560
539
540
+ function ! CheckBackspace () abort
541
+ let col = col (' .' ) - 1
542
+ return ! col || getline (' .' )[col - 1 ] = ~# ' \s'
543
+ endfunction
544
+
545
+ let g: coc_snippet_next = ' <tab>'
561
546
562
547
" ====[ resize split windows ]============================================
563
548
nnoremap <silent> <Leader> + :exe "resize " . (winheight(0) * 3/2)<CR>
@@ -651,27 +636,17 @@ set nowritebackup
651
636
set updatetime = 300
652
637
" Don't pass messages to |ins-completion-menu|.
653
638
set shortmess += c
654
- " Always show the signcolumn, otherwise it would shift the text each time
655
- " diagnostics appear/become resolved.
656
- if has (" nvim-0.5.0" ) || has (" patch-8.1.1564" )
657
- " Recently vim can merge signcolumn and number column into one
658
- set signcolumn = number
659
- else
660
- set signcolumn = yes
661
- endif
639
+
662
640
" Use tab for trigger completion with characters ahead and navigate.
663
641
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
664
642
" other plugin before putting this into your config.
665
- function ! s: check_back_space () abort
666
- let col = col (' .' ) - 1
667
- return ! col || getline (' .' )[col - 1 ] = ~# ' \s'
668
- endfunction
643
+ " inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : "\<Tab>"
644
+ " inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
669
645
670
- inoremap <silent> <expr> <TAB>
671
- \ pumvisible() ? "\<C-n> " :
672
- \ <SID> check_back_space() ? "\<TAB> " :
673
- \ coc#refresh()
674
- inoremap <expr> <S-TAB> pumvisible() ? "\<C-p> " : "\<C-h> "
646
+ " Make <CR> to accept selected completion item or notify coc.nvim to format
647
+ " <C-g>u breaks current undo, please make your own choice.
648
+ " inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
649
+ " \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
675
650
676
651
" Use <c-space> to trigger completion.
677
652
if has (' nvim' )
@@ -680,11 +655,6 @@ else
680
655
inoremap <silent> <expr> <c-@> coc#refresh()
681
656
endif
682
657
683
- " Make <CR> to accept selected completion item or notify coc.nvim to format
684
- " <C-g>u breaks current undo, please make your own choice.
685
- inoremap <silent> <expr> <CR> coc#pum#visible() ? coc#pum#confirm()
686
- \ : "\<C-g> u\<CR> \<c-r> =coc#on_enter()\<CR> "
687
-
688
658
" Use `[g` and `]g` to navigate diagnostics
689
659
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
690
660
nmap <silent> [g <Plug> (coc-diagnostic-prev)
@@ -710,10 +680,10 @@ function! s:show_documentation()
710
680
endfunction
711
681
712
682
" Highlight the symbol and its references when holding the cursor.
713
- augroup coc_highlight
714
- autocmd !
715
- autocmd CursorHold * silent call CocActionAsync (' highlight' )
716
- augroup END
683
+ " augroup coc_highlight
684
+ " autocmd!
685
+ " autocmd CursorHold * silent call CocActionAsync('highlight')
686
+ " augroup END
717
687
718
688
" Symbol renaming.
719
689
nmap <leader> rn <Plug> (coc-rename)
0 commit comments