blob: 342778637b6b23cacd361c98c040415612b3c137 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
if exists('g:loaded_nvim_lsp_installer') | finish | endif
let g:loaded_nvim_lsp_installer = 1
let s:save_cpo = &cpo
set cpo&vim
function! s:LspInstallCompletion(...) abort
return join(luaeval("require'nvim-lsp-installer'.get_available_servers()"), "\n")
endfunction
function! s:LspUninstallCompletion(...) abort
return join(
\ map(luaeval("require'nvim-lsp-installer'.get_installed_servers()"), {_, val -> val.name}),
\ "\n")
endfunction
function! s:LspInstall(server) abort
call luaeval("require'nvim-lsp-installer'.install(_A)", a:server)
endfunction
function! s:LspInstallAll() abort
for server in luaeval("require'nvim-lsp-installer'.get_uninstalled_servers()")
call luaeval("require'nvim-lsp-installer'.install(_A)", server)
endfor
endfunction
function! s:LspUninstall(server) abort
call luaeval("require'nvim-lsp-installer'.uninstall(_A)", a:server)
endfunction
function! s:LspUninstallAll() abort
for server in luaeval("require'nvim-lsp-installer'.get_installed_servers()")
call s:LspUninstall(server)
endfor
endfunction
function! s:LspPrintInstalled() abort
echo map(luaeval("require'nvim-lsp-installer'.get_installed_servers()"), {_, val -> val.name})
endfunction
command! -nargs=1 -complete=custom,s:LspInstallCompletion LspInstall exe s:LspInstall("<args>")
command! -nargs=1 -complete=custom,s:LspUninstallCompletion LspUninstall exe s:LspUninstall("<args>")
command! LspInstallAll call s:LspInstallAll()
command! LspUninstallAll call s:LspUninstallAll()
command! LspPrintInstalled call s:LspPrintInstalled()
let &cpo = s:save_cpo
unlet s:save_cpo
|