ConfigsJul 28, 2026·3 min read

nvim-lspconfig — Quickstart Configurations for Neovim LSP

Provides default configurations for dozens of language servers so you can set up Neovim's built-in LSP client with minimal boilerplate — just install the server and call setup().

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
nvim-lspconfig
Direct install command
npx -y tokrepo@latest install ec4ed26c-8a1b-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

nvim-lspconfig is the official companion plugin for Neovim's built-in Language Server Protocol client. It ships pre-built configurations for 100+ language servers, handling launch commands, root directory detection, and default settings so developers can enable LSP features with a single setup() call per server.

What nvim-lspconfig Does

  • Provides default launch configurations for 100+ language servers
  • Detects project root directories using language-specific markers (package.json, Cargo.toml, etc.)
  • Validates server availability and reports diagnostic issues via :LspInfo
  • Maps common capabilities like go-to-definition and hover out of the box
  • Exposes hooks (on_attach, capabilities) for custom keybindings and behavior

Architecture Overview

nvim-lspconfig is a thin configuration layer — it does not implement the LSP client itself (that lives in Neovim core). Each server has a Lua file defining the default command, filetypes, root_dir detection function, and settings. When you call require('lspconfig').server.setup(opts), it merges your overrides with the defaults and registers an autocommand that starts the language server when a matching buffer is opened.

Self-Hosting & Configuration

  • Install via your preferred plugin manager alongside Neovim 0.8+
  • Install language servers separately (npm, pip, cargo, system package manager)
  • Call require('lspconfig')..setup({}) for each server you want
  • Override on_attach to define keymaps when a server attaches to a buffer
  • Pass capabilities from nvim-cmp or blink.cmp for enhanced completion

Key Features

  • Covers 100+ servers: pyright, ts_ls, lua_ls, rust_analyzer, gopls, clangd, and more
  • Automatic root directory detection per project type
  • Built-in :LspInfo command for debugging server connections
  • Composable with completion plugins (nvim-cmp, blink.cmp) via capabilities
  • Community-maintained configs that track upstream server changes

Comparison with Similar Tools

  • mason-lspconfig.nvim — Bridges mason.nvim and lspconfig so installed servers auto-configure; complements rather than replaces lspconfig
  • CoC.nvim — Brings its own LSP client and extensions ecosystem; lspconfig uses Neovim's native client
  • ALE — Linting and fixing tool that can use LSP but primarily runs external programs; lspconfig focuses on the LSP protocol
  • none-ls.nvim — Injects diagnostics and code actions from non-LSP sources into the LSP framework; works alongside lspconfig

FAQ

Q: Do I need both mason.nvim and nvim-lspconfig? A: mason.nvim installs servers; nvim-lspconfig configures them. You can install servers manually and skip mason, but using both together simplifies the workflow.

Q: How do I add custom keymaps for LSP actions? A: Pass an on_attach function in your setup() call. This function receives the client and buffer number, and you can define buffer-local keymaps there.

Q: Why does :LspInfo show no active clients? A: The server may not be installed, or the root directory markers were not found. Check that the server binary is on your PATH and that the file is inside a recognized project.

Q: Can I use multiple servers for the same filetype? A: Yes. Call setup() for each server. Neovim can attach multiple LSP clients to the same buffer.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets