|
@ -358,13 +358,23 @@ set shortmess+=c |
|
|
" always show signcolumns |
|
|
" always show signcolumns |
|
|
set signcolumn=yes |
|
|
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> |
|
|
inoremap <silent><expr> <TAB> |
|
|
\ pumvisible() ? "\<C-n>" : |
|
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" : |
|
|
|
|
|
\ coc#refresh() |
|
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" |
|
|
|
|
|
|
|
|
\ coc#pum#visible() ? coc#pum#next(1): |
|
|
|
|
|
\ CheckBackSpace() ? "\<Tab>" : |
|
|
|
|
|
\ coc#refresh() |
|
|
|
|
|
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" |
|
|
|
|
|
"}}} |
|
|
|
|
|
|
|
|
function! s:check_back_space() abort |
|
|
function! s:check_back_space() abort |
|
|
let col = col('.') - 1 |
|
|
let col = col('.') - 1 |
|
@ -374,10 +384,6 @@ endfunction |
|
|
" Use <c-space> to trigger completion. |
|
|
" Use <c-space> to trigger completion. |
|
|
inoremap <silent><expr> <c-space> coc#refresh() |
|
|
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 |
|
|
" Use `[c` and `]c` to navigate diagnostics |
|
|
nmap <silent> [c <Plug>(coc-diagnostic-prev) |
|
|
nmap <silent> [c <Plug>(coc-diagnostic-prev) |
|
|
nmap <silent> ]c <Plug>(coc-diagnostic-next) |
|
|
nmap <silent> ]c <Plug>(coc-diagnostic-next) |
|
@ -464,10 +470,6 @@ nnoremap <silent> <space>p :<C-u>CocListResume<CR>: |
|
|
" snippets |
|
|
" snippets |
|
|
imap <C-k> <Plug>(coc-snippets-expand-jump) |
|
|
imap <C-k> <Plug>(coc-snippets-expand-jump) |
|
|
|
|
|
|
|
|
" For conceal markers. |
|
|
|
|
|
if has('conceal') |
|
|
|
|
|
set conceallevel=2 concealcursor=niv |
|
|
|
|
|
endif |
|
|
|
|
|
let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets' |
|
|
let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets' |
|
|
"}}} |
|
|
"}}} |
|
|
|
|
|
|
|
|