2021-04-22 00:33:26 +02:00
|
|
|
" Default config
|
2021-04-21 14:52:27 +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>"
|
|
|
|
|
|
|
|
|
2021-04-22 00:33:26 +02:00
|
|
|
" Own config
|
|
|
|
" Project refactoring keybinding
|
|
|
|
nmap <silent> <leader>pwr :CocSearch <C-R>=expand("<cword>")<CR><CR>
|
2021-04-21 14:52:27 +02:00
|
|
|
" Go to definition
|
|
|
|
nmap gd <Plug>(coc-definition)
|
2021-04-22 00:33:26 +02:00
|
|
|
" Return from jump (e.g. go to definition)
|
2021-04-21 14:52:27 +02:00
|
|
|
nmap gb <C-o>
|
2021-04-22 00:33:26 +02:00
|
|
|
" Go to implementation
|
2021-04-21 14:52:27 +02:00
|
|
|
nmap gi <Plug>(coc-implementation)
|
2021-04-22 00:33:26 +02:00
|
|
|
" Show references of word
|
2021-04-21 14:52:27 +02:00
|
|
|
nmap gr <Plug>(coc-references)
|
2021-04-22 00:33:26 +02:00
|
|
|
" Refactor
|
|
|
|
nmap <leader>rf <Plug>(coc-refactor)
|
2021-04-21 14:52:27 +02:00
|
|
|
|
|
|
|
" Jump between diagnostic positions
|
|
|
|
nmap <silent> <leader>dk <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> <leader>dK <Plug>(coc-diagnostic-prev-error)
|
|
|
|
nmap <silent> <leader>dj <Plug>(coc-diagnostic-next)
|
|
|
|
nmap <silent> <leader>dJ <Plug>(coc-diagnostic-next-error)
|
|
|
|
|
2021-04-22 00:33:26 +02:00
|
|
|
" Code formatting
|
|
|
|
" vnoremap <silent>
|
|
|
|
|
2021-04-21 14:52:27 +02:00
|
|
|
" Show full diagnostics list
|
|
|
|
nmap <silent> <leader>dd :CocDiagnostics<CR>
|