From e8a75bc7e2d0818fd8f19d8a23530eaed89ec66d Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Tue, 5 Oct 2021 19:49:17 +0800 Subject: [PATCH] feat(`lang#vim`): add `SPC l s` key binding Add `SPC l s` to show line diagnostics when lsp layer is enabled for vim script. --- autoload/SpaceVim/layers/lang/vim.vim | 7 +++++-- autoload/SpaceVim/lsp.vim | 3 +++ doc/SpaceVim.txt | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/vim.vim b/autoload/SpaceVim/layers/lang/vim.vim index e9f2d4aec..766d20cfd 100644 --- a/autoload/SpaceVim/layers/lang/vim.vim +++ b/autoload/SpaceVim/layers/lang/vim.vim @@ -40,6 +40,7 @@ " key binding Description " SPC l e rename symbol " SPC l x show references +" SPC l s show line diagnostics " SPC l d show document " K show document " < @@ -149,11 +150,13 @@ function! s:language_specified_mappings() abort nnoremap K :call SpaceVim#lsp#show_doc() 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', 's'], + \ 'call SpaceVim#lsp#show_line_diagnostics()', 'show-line-diagnostics', 1) endif endfunction diff --git a/autoload/SpaceVim/lsp.vim b/autoload/SpaceVim/lsp.vim index 476e5d279..f9b92855b 100644 --- a/autoload/SpaceVim/lsp.vim +++ b/autoload/SpaceVim/lsp.vim @@ -47,6 +47,9 @@ if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) || has('nvim-0.6.0 function! SpaceVim#lsp#go_to_impl() abort lua vim.lsp.buf.implementation() endfunction + function! SpaceVim#lsp#show_line_diagnostics() abort + lua vim.lsp.diagnostic.show_line_diagnostics() + endfunction elseif SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_method') ==# 'coc' " use coc.nvim let s:coc_language_servers = {} diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index ebd794320..c68fddf43 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -4263,6 +4263,7 @@ used: key binding Description SPC l e rename symbol SPC l x show references + SPC l s show line diagnostics SPC l d show document K show document <