]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
export function (#561)
authorEnno <Konfekt@users.noreply.github.com>
Fri, 15 Nov 2024 18:29:23 +0000 (19:29 +0100)
committerGitHub <noreply@github.com>
Fri, 15 Nov 2024 18:29:23 +0000 (10:29 -0800)
plugin/lsp.vim

index cc9b42b450dcafad6fdf7b883e25c77766fc24ba..6bf0d1d44e3f3d240dfd349538d925830d92b7d7 100644 (file)
@@ -76,7 +76,7 @@ command! -nargs=0 -bar LspDocumentSymbol lsp.ShowDocSymbols()
 command! -nargs=0 -bar LspFold lsp.FoldDocument()
 
 command! -nargs=0 -bar -range=% LspFormat lsp.TextDocFormat(<range>, <line1>, <line2>)
-def LspFormatFunc(type: string, visual_mode = v:false)
+export def LspFormatFunc(type: string, visual_mode = v:false)
   if visual_mode
     exe "normal! gv:LspFormat\<cr>"
   elseif type ==# 'line'
@@ -86,6 +86,7 @@ def LspFormatFunc(type: string, visual_mode = v:false)
   endif
 enddef
 nnoremap <silent> <plug>(LspFormat)  <Cmd>set operatorfunc=LspFormatFunc<cr>g@
+xnoremap <silent> <plug>(LspFormat)  <Cmd>LspFormat<cr>
 
 command! -nargs=0 -bar -count LspGotoDeclaration lsp.GotoDeclaration(v:false, <q-mods>, <count>)
 command! -nargs=0 -bar -count LspGotoDefinition lsp.GotoDefinition(v:false, <q-mods>, <count>)