From 0770bc5d26afd75f4b87bfba9e6926e55c80d7ca Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Tue, 1 Oct 2019 10:51:51 +0200 Subject: [PATCH] nvim: use coc --- config/fish/conf.d/fisher.fish | 1 - vimrc | 67 +++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 3 deletions(-) delete mode 100644 config/fish/conf.d/fisher.fish diff --git a/config/fish/conf.d/fisher.fish b/config/fish/conf.d/fisher.fish deleted file mode 100644 index b1e84fd..0000000 --- a/config/fish/conf.d/fisher.fish +++ /dev/null @@ -1 +0,0 @@ -fisher copy-user-key-bindings diff --git a/vimrc b/vimrc index edb3dec..dcd9cd4 100644 --- a/vimrc +++ b/vimrc @@ -107,8 +107,7 @@ Plug '~/dgapt', { 'rtp': 'vim' } " Plug '~/lean.vim' Plug 'leanprover/lean.vim' -Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' } -Plug 'Shougo/echodoc.vim' +Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}} Plug 'rickhowe/diffchar.vim' @@ -134,6 +133,8 @@ set vb " turn on the "visual bell" - which is much quie set nobackup se bs=2 +set backupcopy=yes + se inccommand=nosplit set mouse= @@ -201,3 +202,65 @@ augroup my_cm_setup \ }) augroup END +" coc.nvim + + +inoremap coc#refresh() + +" Use for confirm completion, `u` means break undo chain at current position. +" Coc only does snippet and additional edit on confirm. +inoremap pumvisible() ? "\" : "\u\" + +" Use `[c` and `]c` for navigate diagnostics +nmap [c (coc-diagnostic-prev) +nmap ]c (coc-diagnostic-next) + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K for show documentation in preview window +nnoremap K :call show_documentation() + +function! s:show_documentation() + if &filetype == 'vim' + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Highlight symbol under cursor on CursorHold +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Remap for rename current word +nmap rn (coc-rename) + +" Remap for format selected region +vmap f (coc-format-selected) +nmap f (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Remap for do codeAction of selected region, ex: `aap` for current paragraph +vmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) +" Fix autofix problem of current line +nmap qf (coc-fix-current) + +" Use `:Format` for format current buffer +command! -nargs=0 Format :call CocAction('format') + +" Use `:Fold` for fold current buffer +command! -nargs=? Fold :call CocAction('fold', )