Configs2026年7月6日·1 分钟阅读

mason.nvim — Portable Package Manager for Neovim LSP, DAP & Linters

A Neovim plugin that installs and manages LSP servers, DAP adapters, linters, and formatters from a unified registry, with a built-in UI and automatic PATH management.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
mason.nvim
直接安装命令
npx -y tokrepo@latest install a1e83bbf-7937-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

mason.nvim is a Neovim plugin that provides a portable package manager for external editor tooling. It handles downloading, installing, and updating LSP servers, DAP debug adapters, linters, and formatters into a self-contained directory, keeping your system clean and your Neovim environment reproducible.

What mason.nvim Does

  • Installs LSP servers, DAP adapters, linters, and formatters from a curated registry
  • Provides a floating window UI for browsing, installing, and updating packages
  • Manages a dedicated installation directory separate from system paths
  • Automatically configures PATH so Neovim can find installed tools
  • Supports companion plugins for automatic integration with nvim-lspconfig and null-ls

Architecture Overview

mason.nvim maintains a registry of package definitions that describe how to download and install each tool. Packages are installed into a data directory (typically ~/.local/share/nvim/mason) using platform-appropriate methods: npm, pip, cargo, go install, or direct binary downloads. The plugin prepends its bin directory to Neovim's PATH, making installed tools available to LSP clients, formatters, and linters without global installation.

Self-Hosting & Configuration

  • Requires Neovim 0.7+ and Git; some packages need Node.js, Python, or other runtimes
  • Install via lazy.nvim, packer.nvim, or any Neovim plugin manager
  • Pair with mason-lspconfig.nvim for automatic LSP server setup with nvim-lspconfig
  • Configure default package lists with ensure_installed in the setup function
  • Custom registries can override or extend the default package definitions

Key Features

  • Unified interface for tools that would otherwise require separate install steps
  • Cross-platform support for macOS, Linux, and Windows without manual binary management
  • Version pinning ensures reproducible setups across machines
  • Health check command (:checkhealth mason) diagnoses missing dependencies
  • Extensible registry format lets users add private or internal tool packages

Comparison with Similar Tools

  • nvim-lsp-installer — predecessor to mason.nvim (now deprecated); LSP-only scope
  • null-ls / none-ls — injects non-LSP sources into the LSP client; mason installs the tools these use
  • Homebrew — system-wide package manager; mason keeps tools scoped to Neovim
  • mise / asdf — version managers for runtimes; mason focuses specifically on editor tooling
  • COC.nvim — VS Code extension host for Neovim; manages extensions differently than standalone tools

FAQ

Q: Does mason.nvim replace nvim-lspconfig? A: No. mason.nvim installs LSP servers; nvim-lspconfig configures them. Use mason-lspconfig.nvim to bridge the two.

Q: Where are packages installed? A: By default in ~/.local/share/nvim/mason. Override this with the install_root_dir option in the setup call.

Q: Can I use mason.nvim without lazy.nvim? A: Yes. mason.nvim works with any Neovim plugin manager including packer.nvim, vim-plug, and manual installation.

Q: How do I update all installed packages? A: Open the Mason UI with :Mason and press U to update all, or run :MasonUpdate from the command line.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产