*nvim-lsp-installer* Semi-opinionated companion plugin for nvim-lspconfig. Minimum version of neovim: 0.5.0 Author: William Boman ============================================================================== INTRODUCTION *nvim-lsp-installer-introduction* Semi-opinionated companion plugin for nvim-lspconfig. It comes with all batteries included, or at least to the extent possible. Requires neovim `>= 0.5.0`. These are the full requirements to install all servers: - neovim/nvim-lspconfig (https://github.com/neovim/nvim-lspconfig) - For Unix systems: bash(1), git(1), wget(1), unzip(1), tar(1), gzip(1) - For Windows systems: powershell.exe, tar, git - Node.js (LTS) & npm - Python3 & pip3 - go - javac - Ruby & gem To write a custom server installer, please refer to the docs at https://github.com/williamboman/nvim-lsp-installer/blob/main/CUSTOM_SERVERS.md. ============================================================================== QUICK START *nvim-lsp-installer-quickstart* To view the UI for nvim-lsp-installer, run: > :LspInstallInfo < Install a language server via `:LspInstall`, for example: > :LspInstall tsserver < You may also install multiple languages at a time: > :LspInstall tsserver graphql eslintls < Then, somewhere in your initialization script (see `:h init.lua`): > local lsp_installer = require("nvim-lsp-installer") function common_on_attach(client, bufnr) -- ... set up buffer keymaps, etc. end lsp_installer.on_server_ready(function(server) local opts = { on_attach = common_on_attach, } -- (optional) Customize the options passed to the server -- if server.name == "tsserver" then -- opts.root_dir = function() ... end -- end server:setup(opts) vim.cmd [[ do User LspAttachBuffers ]] end) < ============================================================================== COMMANDS *nvim-lsp-installer-commands* *:LspInstallInfo* :LspInstallInfo Opens the UI for nvim-lsp-installer. *:LspInstall* :LspInstall {server_name} ... Installs language servers. *:LspUninstall* :LspUninstall {server_name} ... Uninstalls language servers. *:LspUninstallAll* :LspUninstallAll Uninstalls all installed language servers. *:LspPrintInstalled* :LspPrintInstalled Prints all installed language servers. ============================================================================== OPTIONS *nvim-lsp-installer-options* *g:lsp_installer_allow_federated_servers* *vim.g.lsp_installer_allow_federated_servers* VimL: g:lsp_installer_allow_federated_servers Lua: vim.g.lsp_installer_allow_federated_servers Type: |Boolean| Default: `true` (`v:true`) Whether to allow LSP servers to share the same installation directory. For some servers, this effectively causes more than one server to be installed (and uninstalled) when executing `:LspInstall` and `:LspUninstall`. For example, installing `cssls` will also install both `jsonls` and `html` (and the other ways around), as these all share the same underlying package. Example: > let g:lsp_installer_allow_federated_servers = v:false vim.g.lsp_installer_allow_federated_servers = false < ============================================================================== Lua module: nvim-lsp-installer *nvim-lsp-installer.install()* install({server_name}) Installs the provided {server_name}. If {server_name} is already installed, it is reinstalled. Parameters: ~ {server_name} (string) The server to install. *nvim-lsp-installer.uninstall()* uninstall({server_name}) Uninstalls the provided {server_name}. Parameters: ~ {server_name} (string) The server to uninstall. *nvim-lsp-installer.on_server_ready()* on_server_ready({cb}) Registers a callback to be executed each time a server is ready to be initiated. When called, all currently installed servers will be considered ready to be initiated and will each individually be invoked on {cb}. Parameters: ~ {cb} (function) Function to be invoked when a server is ready to be initiated. Return: ~ Returns a function which when called will de-register the cb} from any future dispatches. ============================================================================== Lua module: nvim-lsp-installer.servers *nvim-lsp-installer.servers* *nvim-lsp-installer.get_available_servers()* get_available_servers() Return: ~ |lsp_installer.Server|[] A list containing all available language servers. *nvim-lsp-installer.get_installed_servers()* get_installed_servers() Return: ~ |lsp_installer.Server|[] A list of servers that are currently installed. *nvim-lsp-installer.get_uninstalled_servers()* get_uninstalled_servers() Return: ~ |lsp_installer.Server|[] A list of servers that are not installed. *nvim-lsp-installer.register()* register({server}) Registers a {server} instance with nvim-lsp-installer. {server} must be an instance of |lsp_installer.Server|. Parameters: ~ {server} (|lsp_installer.Server|) The server to register. *nvim-lsp-installer.get_server()* get_server({server_name}) Parameters: ~ {server_name} (string) The server instance to retrieve. Return: ~ ok: boolean, server: |lsp_installer.Server| Example: ~ > local lsp_installer = require'nvim-lsp-installer' local ok, rust_server = lsp_installer.get_server("rust_analyzer") if ok then rust_server:install() end < ============================================================================== Lua module: nvim-lsp-installer.server *nvim-lsp-installer.server* *nvim-lsp-installer.Server* class: Server This class enables installing, uninstalling, and setting up language servers. Methods: ~ - setup({opts}) Sets up the language server. This has the same function signature as the setup function in nvim-lspconfig. See |lspconfig-custom-config| for more information on {opts}. - get_default_options() Returns a deep copy of the default options provided to lspconfig in the setup({opts}) method. - is_installed() Returns {true} is server is installed, else returns {false}. - install() Installs this instance of an LSP server. - uninstall() Uninstalls this instance of an LSP server. vim:tw=78:ft=help:norl: