2020-08-08 20:27:01 +02:00
|
|
|
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()
|
|
|
|
|
|
|
|
" Navigating through results list
|
|
|
|
" Tab to select next result
|
|
|
|
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
|
|
" Shift+Tab to select previous
|
|
|
|
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
|
|
" Use enter to confirm completion
|
|
|
|
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
" Select first option if no option is selected on enter
|
|
|
|
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>"
|
2020-08-20 14:29:03 +02:00
|
|
|
|
|
|
|
" Project refactoring keybinding
|
|
|
|
nnoremap <silent> <leader>pwr :CocSearch <C-R>=expand("<cword>")<CR><CR>
|
2020-08-28 09:15:08 +02:00
|
|
|
|
|
|
|
" Go to definition
|
|
|
|
nmap gd <Plug>(coc-definition)
|
|
|
|
nmap gi <Plug>(coc-implementation)
|
|
|
|
nmap gr <Plug>(coc-references)
|
|
|
|
|
|
|
|
" Jump between diagnostic positions
|
|
|
|
nmap <silent> dk <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> dK <Plug>(coc-diagnostic-prev-error)
|
|
|
|
nmap <silent> dj <Plug>(coc-diagnostic-next)
|
|
|
|
nmap <silent> dJ <Plug>(coc-diagnostic-next-error)
|
|
|
|
|
|
|
|
" Show full diagnostics list
|
|
|
|
nmap <silent> <leader>dd :CocDiagnostics<CR>
|
|
|
|
|