1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 18:25:42 +08:00

feat(lang#rust): add more lsp key bindings for rust

This commit is contained in:
Shidong Wang 2021-10-10 23:16:11 +08:00
parent 773aa07b46
commit da40455f5c
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
2 changed files with 47 additions and 6 deletions

View File

@ -10,7 +10,8 @@
""
" @section lang#rust, layers-lang-rust
" @parentsection layers
" This layer is for Rust development.
" `lang#rust` layers provides rust programming language support for SpaceVim.
" This layers includes syntax highlighting, code runner, REPL for rust.
"
" Requirements:
"
@ -81,6 +82,20 @@
" SPC l s s send selection text
" <
"
" If the lsp layer is enabled for python, the following key bindings can
" be used:
" >
" key binding Description
" g D jump to type definition
" SPC l e rename symbol
" SPC l x show references
" SPC l s show line diagnostics
" SPC l d show document
" K show document
" SPC l w l list workspace folder
" SPC l w a add workspace folder
" SPC l w r remove workspace folder
" <
if exists('s:racer_cmd')
finish
@ -182,12 +197,23 @@ function! s:language_specified_mappings() abort
if SpaceVim#layers#lsp#check_filetype('rust')
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
nnoremap <silent><buffer> gD :<C-u>call SpaceVim#lsp#go_to_typedef()<Cr>
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#show_doc()', 'show documentation', 1)
\ 'call SpaceVim#lsp#show_doc()', 'show-document', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'x'],
\ 'call SpaceVim#lsp#references()', 'show-references', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'u'],
\ 'call SpaceVim#lsp#references()', 'show references', 1)
\ 'call SpaceVim#lsp#rename()', 'rename-symbol', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 's'],
\ 'call SpaceVim#lsp#show_line_diagnostics()', 'show-line-diagnostics', 1)
let g:_spacevim_mappings_space.l.w = {'name' : '+Workspace'}
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'l'],
\ 'call SpaceVim#lsp#list_workspace_folder()', 'list-workspace-folder', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'a'],
\ 'call SpaceVim#lsp#add_workspace_folder()', 'add-workspace-folder', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'r'],
\ 'call SpaceVim#lsp#remove_workspace_folder()', 'remove-workspace-folder', 1)
else
nmap <silent><buffer> K <Plug>(rust-doc)
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'd'],

View File

@ -3782,7 +3782,8 @@ This layer also provides REPL support for ruby, the key bindings are:
==============================================================================
LANG#RUST *SpaceVim-layers-lang-rust*
This layer is for Rust development.
`lang#rust` layers provides rust programming language support for SpaceVim.
This layers includes syntax highlighting, code runner, REPL for rust.
Requirements:
@ -3859,6 +3860,20 @@ This layer also provides REPL support for rust, the key bindings are:
SPC l s s send selection text
<
If the lsp layer is enabled for python, the following key bindings can be
used:
>
key binding Description
g D jump to type definition
SPC l e rename symbol
SPC l x show references
SPC l s show line diagnostics
SPC l d show document
K show document
SPC l w l list workspace folder
SPC l w a add workspace folder
SPC l w r remove workspace folder
<
==============================================================================
LANG#SCALA *SpaceVim-layers-lang-scala*