nvim: use coc
This commit is contained in:
parent
75b43fe93f
commit
0770bc5d26
@ -1 +0,0 @@
|
||||
fisher copy-user-key-bindings
|
67
vimrc
67
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 <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> for confirm completion, `<C-g>u` means break undo chain at current position.
|
||||
" Coc only does snippet and additional edit on confirm.
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
" Use `[c` and `]c` for navigate diagnostics
|
||||
nmap <silent> [c <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]c <Plug>(coc-diagnostic-next)
|
||||
|
||||
" Remap keys for gotos
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K for show documentation in preview window
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if &filetype == 'vim'
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight symbol under cursor on CursorHold
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Remap for format selected region
|
||||
vmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(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: `<leader>aap` for current paragraph
|
||||
vmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap for do codeAction of current line
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Fix autofix problem of current line
|
||||
nmap <leader>qf <Plug>(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', <f-args>)
|
||||
|
Loading…
Reference in New Issue
Block a user