From 37fb7397959ae6d0312f12156c4966eca0b2ef1c Mon Sep 17 00:00:00 2001 From: Alexander Gehrke Date: Wed, 11 Aug 2021 12:22:48 +0200 Subject: [PATCH] Map coc.nvim bindings only if coc is installed --- after/plugin/coc.vim | 29 ++++++++++++++++------------- after/plugin/general.vim | 11 +++++------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/after/plugin/coc.vim b/after/plugin/coc.vim index fefda94..ca3afb4 100644 --- a/after/plugin/coc.vim +++ b/after/plugin/coc.vim @@ -1,17 +1,20 @@ -map gd (coc-definition) +if exists(":CocAction") + set signcolumn=yes + map gd (coc-definition) -map :call CocAction("doHover") -map t (coc-type-definition) -map u (coc-references) -map r (coc-rename) -map q (coc-quickfix) + map call CocAction("doHover") + map t (coc-type-definition) + map u (coc-references) + map r (coc-rename) + map q (coc-quickfix) -map F (coc-format) -map f (coc-format-selected) -vmap f (coc-format-selected) + map F (coc-format) + map f (coc-format-selected) + vmap f (coc-format-selected) -map (coc-codeaction) -vmap (coc-codeaction-selected) + map (coc-codeaction) + vmap (coc-codeaction-selected) -omap af (coc-funcobj-a) -omap if (coc-funcobj-i) + omap af (coc-funcobj-a) + omap if (coc-funcobj-i) +endif diff --git a/after/plugin/general.vim b/after/plugin/general.vim index bbe1877..b816a66 100644 --- a/after/plugin/general.vim +++ b/after/plugin/general.vim @@ -7,14 +7,13 @@ endif "inoremap deoplete#smart_close_popup()."\" "inoremap deoplete#smart_close_popup()."\" -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() - "\ '\' +"inoremap +" \ pumvisible() ? "\" : +" \ check_back_space() ? "\" : +" \ '\' function! s:check_back_space() let col = col('.') - 1 return !col || getline('.')[col - 1] =~ '\s' endfunction -inoremap coc#refresh() +"inoremap