|
|
@ -358,13 +358,23 @@ set shortmess+=c |
|
|
|
" always show signcolumns |
|
|
|
set signcolumn=yes |
|
|
|
|
|
|
|
" Use tab for trigger completion with characters ahead and navigate. |
|
|
|
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin. |
|
|
|
" {{{ coc completion |
|
|
|
"Use <tab> and <S-tab> to navigate completion list: |
|
|
|
|
|
|
|
function! CheckBackSpace() abort |
|
|
|
let col = col('.') - 1 |
|
|
|
return !col || getline('.')[col - 1] =~ '\s' |
|
|
|
endfunction |
|
|
|
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#_select_confirm() |
|
|
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" |
|
|
|
|
|
|
|
" Insert <tab> when previous text is space, refresh completion if not. |
|
|
|
inoremap <silent><expr> <TAB> |
|
|
|
\ pumvisible() ? "\<C-n>" : |
|
|
|
\ <SID>check_back_space() ? "\<TAB>" : |
|
|
|
\ coc#pum#visible() ? coc#pum#next(1): |
|
|
|
\ CheckBackSpace() ? "\<Tab>" : |
|
|
|
\ coc#refresh() |
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" |
|
|
|
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" |
|
|
|
"}}} |
|
|
|
|
|
|
|
function! s:check_back_space() abort |
|
|
|
let col = col('.') - 1 |
|
|
@ -374,10 +384,6 @@ endfunction |
|
|
|
" Use <c-space> to trigger completion. |
|
|
|
inoremap <silent><expr> <c-space> 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>" |
|
|
|
|
|
|
|
" Use `[c` and `]c` to navigate diagnostics |
|
|
|
nmap <silent> [c <Plug>(coc-diagnostic-prev) |
|
|
|
nmap <silent> ]c <Plug>(coc-diagnostic-next) |
|
|
|