1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 15:19:12 +08:00

add additional bindings from coc.nvim for c layer (#2967)

This commit is contained in:
Stefan Lendl 2019-07-25 15:49:27 +02:00 committed by Wang Shidong
parent c7f1f6a2dd
commit 84e9b1b8bb
2 changed files with 31 additions and 2 deletions

View File

@ -191,6 +191,19 @@ function! s:language_specified_mappings() abort
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'f'],
\ 'call SpaceVim#lsp#references()', 'references', 1)
" these work for now with coc.nvim only
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'i'],
\ 'call SpaceVim#lsp#go_to_impl()', 'implementation', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 't'],
\ 'call SpaceVim#lsp#go_to_typedef()', 'type definition', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'R'],
\ 'call SpaceVim#lsp#refactor()', 'refactor', 1)
" TODO this should be gD
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'D'],
\ 'call SpaceVim#lsp#go_to_declaration()', 'declaration', 1)
endif
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],

View File

@ -63,7 +63,23 @@ if SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_me
endfunction
function! SpaceVim#lsp#go_to_def() abort
call CocActionAsync('jumpDefinition')
call CocAction('jumpDefinition')
endfunction
function! SpaceVim#lsp#go_to_declaration() abort
call CocAction('jumpDeclaration')
endfunction
function! SpaceVim#lsp#go_to_typedef() abort
call CocAction('jumpTypeDefinition')
endfunction
function! SpaceVim#lsp#go_to_impl() abort
call CocAction('jumpImplementation')
endfunction
function! SpaceVim#lsp#refactor() abort
call CocActionAsync('refactor')
endfunction
function! SpaceVim#lsp#rename() abort
@ -71,7 +87,7 @@ if SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_me
endfunction
function! SpaceVim#lsp#references() abort
call CocActionAsync('jumpReferences')
call CocAction('jumpReferences')
endfunction
elseif has('nvim')
" use LanguageClient-neovim