neovim by julianobarbosa/claude-code-skills
npx skills add https://github.com/julianobarbosa/claude-code-skills --skill neovim一份关于使用基于 lazy.nvim 构建的模块化、性能优化的 Neovim 配置的全面指南。
| 指标 | 值 |
|---|---|
| 插件管理器 | lazy.nvim |
| 插件总数 | 82 |
| 目标启动时间 | <50ms |
| 模块模式 | M.setup() |
| Leader 键 | <Space> |
~/.config/nvim/
├── init.lua # 入口点
├── lua/
│ ├── config/ # 核心配置 (11 个模块)
│ │ ├── lazy.lua # 插件管理器引导
│ │ ├── options.lua # Vim 选项
│ │ ├── keymaps.lua # 按键绑定
│ │ ├── autocmds.lua # 自动命令
│ │ └── performance.lua # 启动优化
│ ├── plugins/specs/ # 插件规格 (9 个类别)
│ │ ├── core.lua # 基础 (plenary, nui, devicons)
│ │ ├── ui.lua # 用户界面 (lualine, bufferline, noice)
│ │ ├── editor.lua # 编辑器 (autopairs, flash, harpoon)
│ │ ├── lsp.lua # LSP (lspconfig, mason, conform)
│ │ ├── git.lua # Git (fugitive, gitsigns, diffview)
│ │ ├── ai.lua # 人工智能 (copilot, ChatGPT)
│ │ ├── debug.lua # DAP (nvim-dap, dap-ui)
│ │ ├── tools.lua # 工具 (telescope, neo-tree)
│ │ └── treesitter.lua # 语法 (treesitter, textobjects)
│ ├── kickstart/ # 源自 Kickstart 的模块
│ └── utils/ # 工具函数
└── lazy-lock.json # 插件版本锁定
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
所有配置模块都遵循 M.setup() 模式:
local M = {}
M.setup = function()
-- 配置逻辑写在这里
end
return M
添加到 lua/plugins/specs/ 中相应的类别文件:
-- lua/plugins/specs/tools.lua
return {
-- 现有插件...
{
"author/plugin-name",
event = "VeryLazy", -- 加载策略
dependencies = { "dep/name" }, -- 依赖插件
opts = {
-- 插件选项
},
config = function(_, opts)
require("plugin-name").setup(opts)
end,
},
}
| 策略 | 何时使用 | 示例 |
|---|---|---|
lazy = true | 默认,按需加载 | 大多数插件 |
event = "VeryLazy" | 用户界面加载后 | 用户界面增强 |
event = "BufReadPre" | 打开文件时 | Treesitter, gitsigns |
event = "InsertEnter" | 输入时 | 补全, autopairs |
cmd = "CommandName" | 调用命令时 | 重型工具 |
ft = "filetype" | 针对特定文件类型 | 语言插件 |
keys = {...} | 按键时 | 移动插件 |
| 命令 | 描述 |
|---|---|
:Lazy | 打开 lazy.nvim 仪表板 |
:Lazy sync | 更新和安装插件 |
:Lazy profile | 显示启动时间分析 |
:Lazy clean | 移除未使用的插件 |
:Lazy health | 检查插件健康状况 |
完整 LSP 参考请参阅 references/lsp.md。
mason.nvim (安装器)
├── mason-lspconfig.nvim → nvim-lspconfig
├── mason-tool-installer.nvim (自动安装)
└── mason-nvim-dap.nvim → nvim-dap
nvim-lspconfig
├── blink.cmp (补全)
├── conform.nvim (格式化)
├── nvim-lint (代码检查)
└── trouble.nvim (诊断)
-- 在 lua/plugins/specs/lsp.lua 中,添加到 mason-tool-installer 列表:
ensure_installed = {
"lua_ls",
"pyright",
"your_new_server", -- 在此处添加
}
-- 在 lspconfig 设置中配置:
servers = {
your_new_server = {
settings = {
-- 服务器特定设置
},
},
}
| 按键 | 动作 |
|---|---|
gd | 跳转到定义 |
gr | 跳转到引用 |
gI | 跳转到实现 |
gD | 跳转到声明 |
K | 悬停文档 |
<leader>rn | 重命名符号 |
<leader>ca | 代码操作 |
<leader>D | 类型定义 |
<leader>ds | 文档符号 |
<leader>ws | 工作区符号 |
完整参考请参阅 references/keybindings.md。
| 按键 | 动作 |
|---|---|
<C-h/j/k/l> | 窗口导航 |
<S-h> / <S-l> | 上一个/下一个缓冲区 |
<leader>sf | 搜索文件 |
<leader>sg | 通过 grep 搜索 |
<leader><space> | 搜索缓冲区 |
\\ | 切换 Neo-tree |
-- 在 lua/config/keymaps.lua M.setup() 中:
vim.keymap.set('n', '<leader>xx', function()
-- 你的操作
end, { desc = 'which-key 的描述' })
-- 或者在插件规格中:
keys = {
{ "<leader>xx", "<cmd>Command<CR>", desc = "描述" },
}
完整参考请参阅 references/debugging.md。
| 按键 | 动作 |
|---|---|
<F5> | 继续/开始调试 |
<F10> | 单步跳过 |
<F11> | 单步进入 |
<F12> | 单步跳出 |
<leader>b | 切换断点 |
<leader>B | 条件断点 |
-- 在 lua/plugins/specs/debug.lua 中
local dap = require("dap")
dap.adapters.your_adapter = {
type = "executable",
command = "path/to/adapter",
}
dap.configurations.your_filetype = {
{
type = "your_adapter",
request = "launch",
name = "启动",
program = "${file}",
},
}
| 层级 | 技术 | 节省时间 |
|---|---|---|
| 1 | vim.loader.enable() | ~50ms |
| 2 | 跳过 vim._defaults | ~180ms |
| 3 | 禁用 providers | ~10ms |
| 4 | 禁用内置功能 | ~20ms |
| 5 | 延迟配置 | ~30ms |
| 6 | 基于事件的加载 | 可变 |
:Lazy profile
-- 在 init.lua 中
vim.defer_fn(function()
require('config.options').setup()
require('config.keymaps').setup()
require('config.autocmds').setup()
end, 0)
-- 在 lua/config/autocmds.lua M.setup() 中:
vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown", "text" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- 在 lua/config/options.lua M.setup() 中:
vim.opt.your_option = value
-- 在 lua/utils/init.lua 中
local M = {}
M.your_function = function(args)
-- 实现
end
return M
-- 用法:require('utils').your_function(args)
plenary.nvim, nui.nvim, nvim-web-devicons, lazy.nvim
tokyonight, alpha-nvim, lualine, bufferline, noice, nvim-notify, which-key, indent-blankline, mini.indentscope, fidget, nvim-scrollbar
nvim-autopairs, flash.nvim, clever-f, nvim-spectre, grug-far, harpoon, persistence, smartyank, vim-sleuth, vim-illuminate, tabular, todo-comments, toggleterm
nvim-lspconfig, mason, mason-lspconfig, mason-tool-installer, lazydev, luvit-meta, SchemaStore, conform, nvim-lint, trouble, blink.cmp/nvim-cmp, LuaSnip
vim-fugitive, vim-rhubarb, gitsigns, diffview, vim-flog, git-conflict, octo
copilot.vim, ChatGPT.nvim, mcphub.nvim
nvim-dap, nvim-dap-ui, nvim-dap-virtual-text, nvim-dap-python, nvim-dap-go, mason-nvim-dap, telescope-dap, nvim-nio
telescope, telescope-fzf-native, telescope-ui-select, neo-tree, oil.nvim, nvim-bqf, rest.nvim, vim-dadbod, vim-dadbod-ui, vim-dadbod-completion, iron.nvim, markdown-preview, nvim-puppeteer, obsidian.nvim
nvim-treesitter, nvim-treesitter-context, nvim-treesitter-textobjects
| 问题 | 解决方案 |
|---|---|
| 插件未加载 | :Lazy sync |
| LSP 未启动 | :LspInfo, :Mason |
| 图标缺失 | 安装 Nerd Font |
| 启动缓慢 | :Lazy profile |
| Treesitter 错误 | :TSUpdate |
| 按键绑定冲突 | :verbose map <key> |
:checkhealth
-- 临时添加到插件配置中:
log_level = vim.log.levels.DEBUG,
每周安装数
98
仓库
GitHub Stars
43
首次出现
2026年1月24日
安全审计
安装于
gemini-cli87
opencode86
codex84
cursor84
github-copilot82
amp71
A comprehensive guide for working with this modular, performance-optimized Neovim configuration built on lazy.nvim.
| Metric | Value |
|---|---|
| Plugin Manager | lazy.nvim |
| Total Plugins | 82 |
| Target Startup | <50ms |
| Module Pattern | M.setup() |
| Leader Key | <Space> |
~/.config/nvim/
├── init.lua # Entry point
├── lua/
│ ├── config/ # Core configuration (11 modules)
│ │ ├── lazy.lua # Plugin manager bootstrap
│ │ ├── options.lua # Vim options
│ │ ├── keymaps.lua # Key bindings
│ │ ├── autocmds.lua # Autocommands
│ │ └── performance.lua # Startup optimization
│ ├── plugins/specs/ # Plugin specs (9 categories)
│ │ ├── core.lua # Foundation (plenary, nui, devicons)
│ │ ├── ui.lua # UI (lualine, bufferline, noice)
│ │ ├── editor.lua # Editor (autopairs, flash, harpoon)
│ │ ├── lsp.lua # LSP (lspconfig, mason, conform)
│ │ ├── git.lua # Git (fugitive, gitsigns, diffview)
│ │ ├── ai.lua # AI (copilot, ChatGPT)
│ │ ├── debug.lua # DAP (nvim-dap, dap-ui)
│ │ ├── tools.lua # Tools (telescope, neo-tree)
│ │ └── treesitter.lua # Syntax (treesitter, textobjects)
│ ├── kickstart/ # Kickstart-derived modules
│ └── utils/ # Utility functions
└── lazy-lock.json # Plugin version lock
All configuration modules follow the M.setup() pattern:
local M = {}
M.setup = function()
-- Configuration logic here
end
return M
Add to the appropriate category file in lua/plugins/specs/:
-- lua/plugins/specs/tools.lua
return {
-- Existing plugins...
{
"author/plugin-name",
event = "VeryLazy", -- Loading strategy
dependencies = { "dep/name" }, -- Required plugins
opts = {
-- Plugin options
},
config = function(_, opts)
require("plugin-name").setup(opts)
end,
},
}
| Strategy | When to Use | Example |
|---|---|---|
lazy = true | Default, load on demand | Most plugins |
event = "VeryLazy" | After UI loads | UI enhancements |
event = "BufReadPre" | When opening files | Treesitter, gitsigns |
event = "InsertEnter" | When typing | Completion, autopairs |
cmd = "CommandName" | On command invocation |
| Command | Description |
|---|---|
:Lazy | Open lazy.nvim dashboard |
:Lazy sync | Update and install plugins |
:Lazy profile | Show startup time analysis |
:Lazy clean | Remove unused plugins |
:Lazy health | Check plugin health |
See references/lsp.md for complete LSP reference.
mason.nvim (installer)
├── mason-lspconfig.nvim → nvim-lspconfig
├── mason-tool-installer.nvim (auto-install)
└── mason-nvim-dap.nvim → nvim-dap
nvim-lspconfig
├── blink.cmp (completion)
├── conform.nvim (formatting)
├── nvim-lint (linting)
└── trouble.nvim (diagnostics)
-- In lua/plugins/specs/lsp.lua, add to mason-tool-installer list:
ensure_installed = {
"lua_ls",
"pyright",
"your_new_server", -- Add here
}
-- Configure in lspconfig setup:
servers = {
your_new_server = {
settings = {
-- Server-specific settings
},
},
}
| Key | Action |
|---|---|
gd | Go to definition |
gr | Go to references |
gI | Go to implementation |
gD | Go to declaration |
K | Hover documentation |
<leader>rn | Rename symbol |
<leader>ca |
See references/keybindings.md for complete reference.
| Key | Action |
|---|---|
<C-h/j/k/l> | Window navigation |
<S-h> / <S-l> | Previous/next buffer |
<leader>sf | Search files |
<leader>sg | Search by grep |
<leader><space> | Search buffers |
\\ |
-- In lua/config/keymaps.lua M.setup():
vim.keymap.set('n', '<leader>xx', function()
-- Your action
end, { desc = 'Description for which-key' })
-- Or in a plugin spec:
keys = {
{ "<leader>xx", "<cmd>Command<CR>", desc = "Description" },
}
See references/debugging.md for complete reference.
| Key | Action |
|---|---|
<F5> | Continue/Start debugging |
<F10> | Step over |
<F11> | Step into |
<F12> | Step out |
<leader>b | Toggle breakpoint |
<leader>B | Conditional breakpoint |
-- In lua/plugins/specs/debug.lua
local dap = require("dap")
dap.adapters.your_adapter = {
type = "executable",
command = "path/to/adapter",
}
dap.configurations.your_filetype = {
{
type = "your_adapter",
request = "launch",
name = "Launch",
program = "${file}",
},
}
| Layer | Technique | Savings |
|---|---|---|
| 1 | vim.loader.enable() | ~50ms |
| 2 | Skip vim._defaults | ~180ms |
| 3 | Disable providers | ~10ms |
| 4 | Disable builtins | ~20ms |
| 5 | Deferred config | ~30ms |
| 6 | Event-based loading | Variable |
:Lazy profile
-- In init.lua
vim.defer_fn(function()
require('config.options').setup()
require('config.keymaps').setup()
require('config.autocmds').setup()
end, 0)
-- In lua/config/autocmds.lua M.setup():
vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown", "text" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- In lua/config/options.lua M.setup():
vim.opt.your_option = value
-- In lua/utils/init.lua
local M = {}
M.your_function = function(args)
-- Implementation
end
return M
-- Usage: require('utils').your_function(args)
plenary.nvim, nui.nvim, nvim-web-devicons, lazy.nvim
tokyonight, alpha-nvim, lualine, bufferline, noice, nvim-notify, which-key, indent-blankline, mini.indentscope, fidget, nvim-scrollbar
nvim-autopairs, flash.nvim, clever-f, nvim-spectre, grug-far, harpoon, persistence, smartyank, vim-sleuth, vim-illuminate, tabular, todo-comments,
nvim-lspconfig, mason, mason-lspconfig, mason-tool-installer, lazydev, luvit-meta, SchemaStore, conform, nvim-lint, trouble, blink.cmp/nvim-cmp,
vim-fugitive, vim-rhubarb, gitsigns, diffview, vim-flog, git-conflict, octo
copilot.vim, ChatGPT.nvim, mcphub.nvim
nvim-dap, nvim-dap-ui, nvim-dap-virtual-text, nvim-dap-python, nvim-dap-go, mason-nvim-dap, telescope-dap, nvim-nio
telescope, telescope-fzf-native, telescope-ui-select, neo-tree, oil.nvim, nvim-bqf, rest.nvim, vim-dadbod, vim-dadbod-ui, vim-dadbod-completion, iron.nvim, markdown-preview, ,
nvim-treesitter, nvim-treesitter-context, nvim-treesitter-textobjects
| Issue | Solution |
|---|---|
| Plugins not loading | :Lazy sync |
| LSP not starting | :LspInfo, :Mason |
| Icons missing | Install a Nerd Font |
| Slow startup | :Lazy profile |
| Treesitter errors | :TSUpdate |
| Keybinding conflicts | :verbose map <key> |
:checkhealth
-- Temporarily add to plugin config:
log_level = vim.log.levels.DEBUG,
Weekly Installs
98
Repository
GitHub Stars
43
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
gemini-cli87
opencode86
codex84
cursor84
github-copilot82
amp71
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
| Heavy tools |
ft = "filetype" | For specific filetypes | Language plugins |
keys = {...} | On keypress | Motion plugins |
| Code action |
<leader>D | Type definition |
<leader>ds | Document symbols |
<leader>ws | Workspace symbols |
| Toggle Neo-tree |
toggletermLuaSnipnvim-puppeteerobsidian.nvim