diff options
| author | William Boman <william@redwill.se> | 2021-04-04 02:18:34 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2021-04-04 17:30:31 +0200 |
| commit | 5fe27b3ed00706a5be6a2b8ba6dfc187cb534e39 (patch) | |
| tree | 340635deeb85cd292e5cb87ad1077a44d3556190 /plugin | |
| download | mason-5fe27b3ed00706a5be6a2b8ba6dfc187cb534e39.tar mason-5fe27b3ed00706a5be6a2b8ba6dfc187cb534e39.tar.gz mason-5fe27b3ed00706a5be6a2b8ba6dfc187cb534e39.tar.bz2 mason-5fe27b3ed00706a5be6a2b8ba6dfc187cb534e39.tar.lz mason-5fe27b3ed00706a5be6a2b8ba6dfc187cb534e39.tar.xz mason-5fe27b3ed00706a5be6a2b8ba6dfc187cb534e39.tar.zst mason-5fe27b3ed00706a5be6a2b8ba6dfc187cb534e39.zip | |
init
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/nvim-lsp-installer.vim | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/plugin/nvim-lsp-installer.vim b/plugin/nvim-lsp-installer.vim new file mode 100644 index 00000000..a4caf2b1 --- /dev/null +++ b/plugin/nvim-lsp-installer.vim @@ -0,0 +1,47 @@ +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(luaeval("require'nvim-lsp-installer'.get_installed_servers()"), "\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 luaeval("require'nvim-lsp-installer'.get_installed_servers()") +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 |
