diff --git a/autoload/SpaceVim/layers/lang/ruby.vim b/autoload/SpaceVim/layers/lang/ruby.vim index f67159c84..3ea4c4d87 100644 --- a/autoload/SpaceVim/layers/lang/ruby.vim +++ b/autoload/SpaceVim/layers/lang/ruby.vim @@ -59,7 +59,30 @@ " SPC l s l send current line " SPC l s s send selection text " < -" +" To enable lsp support for ruby, you need to instal solargraph. +" > +" gem install --user-install solargraph +" < +" Enable the lsp layer for ruby: +" > +" [[layers]] +" name = 'lsp' +" enabled_clients = ['solargraph'] +" < +" If the lsp layer is enabled for ruby, 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 h 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:ruby_file_head') @@ -129,11 +152,23 @@ function! s:language_specified_mappings() abort if SpaceVim#layers#lsp#check_filetype('ruby') \ || SpaceVim#layers#lsp#check_server('solargraph') nnoremap K :call SpaceVim#lsp#show_doc() + nnoremap gD :call SpaceVim#lsp#go_to_typedef() call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], - \ 'call SpaceVim#lsp#show_doc()', 'show_document', 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#lsp#rename()', 'rename-symbol', 1) + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'h'], + \ '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) endif let g:_spacevim_mappings_space.l.s = {'name' : '+Send'} call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'], diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 24e364265..97c4a8a4d 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -4580,7 +4580,29 @@ This layer also provides REPL support for ruby, the key bindings are: SPC l s l send current line SPC l s s send selection text < - +To enable lsp support for ruby, you need to instal solargraph. +> + gem install --user-install solargraph +< +Enable the lsp layer for ruby: +> + [[layers]] + name = 'lsp' + enabled_clients = ['solargraph'] +< +If the lsp layer is enabled for ruby, 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 h 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#RUST *SpaceVim-layers-lang-rust*