Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsJul 28, 2026·3 min de lectura

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().

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
nvim-lspconfig
Comando de instalación directa
npx -y tokrepo@latest install ec4ed26c-8a1b-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

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

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados