neovim /nvim-lspconfig

Quickstart configs for Nvim LSP

★ 14,006⑂ 2,502
LuaCreated 2019-11-13
TA的项目
14,006
stars
+8+9+39
2,502
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions

README

nvim-lspconfig

nvim-lspconfig is a collection of LSP server configurations for the Nvim LSP client.

View all configs, or run :help lspconfig-all from Nvim.

 Important ⚠️

 require('lspconfig') (the legacy "framework" of nvim-lspconfig) is deprecated in favor of vim.lsp.config (Nvim 0.11+).
     The lspconfig.lua module will be dropped. Calls to require('lspconfig') will show a warning, which will later become an error.
 nvim-lspconfig itself is NOT deprecated. It provides server-specific configs.
     The configs live in the lsp/ directory. vim.lsp.config automatically finds them and merges them with any local lsp/.lua configs defined by you or a plugin.
     The old configs in lua/lspconfig/ are deprecated and will be removed.

 Migration instructions

1. Upgrade to Nvim 0.11+
2. (Optional) Use vim.lsp.config('…') (not require'lspconfig'.….setup{}) to customize or define a config.
3. Use vim.lsp.enable('…') (not require'lspconfig'.….setup{}) to enable a config, so that it activates for its filetypes.

 Support

These configs are best-effort and supported by the community (you). See contributions.

 Ask questions on GitHub Discussions, not the issue tracker.
 If you found a bug in Nvim LSP (:help lsp), report it to Neovim core.
     Do not report it here. Only configuration data lives here.

 Install



 Requires Nvim 0.11.3+.
     Support for Nvim 0.10 will be removed. Upgrade Nvim and nvim-lspconfig before reporting an issue.
 With Nvim 0.12+, you can use the builtin vim.pack plugin manager:
  lua
  vim.pack.add{
    { src = 'https://github.com/neovim/nvim-lspconfig' },
  }
  
 Or install nvim-lspconfig using Vim's "packages" feature:
  
  git clone https://github.com/neovim/nvim-lspconfig ~/.config/nvim/pack/nvim/start/nvim-lspconfig
  
 Or use a 3rd-party plugin manager.

 Quickstart

1. Install a language server, e.g. pyright
   bash
   npm i -g pyright
   
2. Enable its config in your init.lua (:help lsp-quickstart).
   lua
   vim.lsp.enable('pyright')
   
3. Ensure your project/workspace contains a root marker as specified in :help lspconfig-all.
4. Open a code file in Nvim. LSP will attach and provide diagnostics.
   
   nvim main.py
   
5. Run :checkhealth vim.lsp to see the status or to troubleshoot.

See :help lspconfig-all for the full list of server-specific details. For
servers not on your $PATH (e.g., jdtls, elixirls), you must manually set
the cmd parameter:

lua
vim.lsp.config('jdtls', {
  cmd = { '/path/to/jdtls' },
})


 Commands

 :LspInfo (alias to :checkhealth vim.lsp) shows the status of active and configured language servers.
 :lsp enable [] (:LspStart for Nvim 0.11 or older) Start the requested server name. Will only successfully start if the command detects a root directory matching the current config.
 :lsp disable [] (:LspStop for Nvim 0.11 or older) Stops the given server. Defaults to stopping all servers active on the current buffer. To force stop use :LspStop!
 :lsp restart [] (:LspRestart for Nvim 0.11 or older)

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON