From 3cc9aeea2a0894a556ed798c2b0db734913a19b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= <henrik.tjader@nordicsemi.no> Date: Mon, 1 Aug 2022 16:11:31 +0200 Subject: [PATCH] Latest coc requires setting these --- .vimrc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.vimrc b/.vimrc index efbe7f3..dc52951 100644 --- a/.vimrc +++ b/.vimrc @@ -950,9 +950,26 @@ nmap <silent> <leader>me <Plug>(coc-command)expandMacro nmap <silent> <leader>gh :CocCommand clangd.switchSourceHeader<CR> nmap <silent> <leader>gH :CocCommand clangd.switchSourceHeader vsplit<CR> nmap <silent> <leader>gsi :CocCommand clangd.SymbolInfo<CR> + +" From coc-completion-help 2022-08-01 +inoremap <expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<CR>" + " Use K to show documentation in preview window nnoremap <silent> K :call <SID>show_documentation()<CR> + function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~ '\s' + endfunction + + " Insert <tab> when previous text is space, refresh completion if not. + inoremap <silent><expr> <TAB> + \ coc#pum#visible() ? coc#pum#next(1): + \ <SID>check_back_space() ? "\<Tab>" : + \ coc#refresh() + inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" + + function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('<cword>') -- GitLab