When this skill is activated, always start your first response with the 🧢 emoji.
Vim / Neovim
Neovim is a hyperextensible Vim-based text editor configured entirely in Lua. The ~/.config/nvim/init.lua file is the entry point. Plugins are managed via lazy.nvim, LSPs via mason.nvim, syntax via nvim-treesitter, and fuzzy finding via telescope.nvim. Neovim exposes a rich Lua API (vim.api, vim.keymap, vim.opt, vim.fn) for deep customization without Vimscript.
When to use this skill
Trigger this skill when the user:
- Bootstraps or restructures an
init.luaor~/.config/nvim/directory - Installs or configures plugins with
lazy.nvim - Sets up an LSP server with
mason.nvim+nvim-lspconfig - Configures
telescope.nvimpickers or extensions - Installs or queries
nvim-treesitterparsers - Adds or refactors keymaps with
vim.keymap.set - Writes a custom Lua plugin, module, or autocommand
Do NOT trigger this skill for:
- Generic shell scripting or terminal multiplexer questions unrelated to Neovim
- VS Code, JetBrains, or other editors unless explicitly comparing to Neovim
Key principles
- Lua over Vimscript - All new configuration and plugins must be written in
Lua. Use vim.cmd only for legacy Vimscript interop where no Lua API exists.
- Lazy-load everything - Plugins should specify
event,ft,cmd, or
keys in their lazy.nvim spec so startup time stays under 50 ms.
- Structured config - Split concerns into
lua/config/(options, keymaps,
autocmds) and lua/plugins/ (one file per plugin or logical group).
- LSP-native features first - Prefer built-in LSP for go-to-definition,
rename, diagnostics, and formatting before reaching for external plugins.
- No global namespace pollution - Wrap plugin code in modules and return
public APIs. Never define functions at the global _G level.
Core concepts
Modes
| Mode | Key | Purpose | |------|-----|---------| | Normal | <Esc> | Navigation and operator entry | | Insert | i, a, o | Text insertion | | Visual | v, V, <C-v> | Selection (char/line/block) | | Command | : | Ex commands | | Terminal | :terminal + i | Embedded shell |
Motions
Motions describe where to move: w (word), b (back word), e (end of word), 0/^/$ (line start/first-char/end), gg/G (file start/end), % (matching bracket), f{char} (find char), t{char} (till char), /{pattern} (search forward).
Operators (d, c, y, =, >) combine with motions: dw, ci", ya{.
Text objects
i (inner) and a (around): iw (inner word), i" (inner quotes), i{ (inner braces), ip (inner paragraph), it (inner tag). Use with any operator.
Registers
""- default (unnamed) register"0- last yank"+/"*- system clipboard"_- black hole (discard)"/- last search pattern
Access in insert mode with <C-r>{register}.
Lua API surface
vim.opt.option = value -- set option (OOP style)
vim.o.option = value -- set global option (raw)
vim.keymap.set(mode, lhs, rhs, opts) -- define keymap
vim.api.nvim_create_autocmd(event, opts) -- autocommand
vim.api.nvim_create_user_command(name, fn, opts) -- user command
vim.api.nvim_buf_get_lines(0, 0, -1, false) -- buffer lines
vim.fn.expand("%:p") -- call Vimscript function
vim.cmd("colorscheme catppuccin") -- run Ex command
Common tasks
1. Bootstrap init.lua with lazy.nvim
-- ~/.config/nvim/init.lua
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Leader key must be set before lazy loads plugins
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
require("lazy").setup("plugins", {
change_detection = { notify = false },
install = { colorscheme = { "catppuccin", "habamax" } },
performance = {
rtp = {
disabled_plugins = {
"gzip", "matchit", "netrwPlugin", "tarPlugin",
"tohtml", "tutor", "zipPlugin",
},
},
},
})
require("config.options")
require("config.keymaps")
require("config.autocmds")
Each file in ~/.config/nvim/lua/plugins/ is auto-loaded by lazy.nvim and must return a plugin spec table (or array of specs).
2. Configure LSP with mason
-- lua/plugins/lsp.lua
return {
{
"williamboman/mason.nvim",
build = ":MasonUpdate",
opts = {},
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" },
opts = {
ensure_installed = { "lua_ls", "ts_ls", "pyright", "rust_analyzer" },
automatic_installation = true,
},
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
config = function()
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local on_attach = function(_, bufnr)
local opts = { buffer = bufnr, silent = true }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>f", function()
vim.lsp.buf.format({ async = true })
end, opts)
end
local servers = { "lua_ls", "ts_ls", "pyright", "rust_analyzer" }
for _, server in ipairs(servers) do
lspconfig[server].setup({ capabilities = capabilities, on_attach = on_attach })
end
-- Diagnostics UI
vim.diagnostic.config({
virtual_text = { prefix = "●" },
signs = true,
underline = true,
update_in_insert = false,
severity_sort = true,
})
end,
},
}
3. Set up telescope
-- lua/plugins/telescope.lua
return {
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
keys = {
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" },
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live grep" },
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help tags" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent files" },
},
dependencies = {
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
config = function()
local telescope = require("telescope")
telescope.setup({
defaults = {
sorting_strategy = "ascending",
layout_config = { prompt_position = "top" },
mappings = {
i = {
["<C-j>"] = "move_selection_next",
["<C-k>"] = "move_selection_previous",
["<C-q>"] = "send_selected_to_qflist",
},
},
},
})
telescope.load_extension("fzf")
end,
},
}
4. Configure treesitter
-- lua/plugins/treesitter.lua
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" },
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"lua", "vim", "vimdoc", "typescript", "javascript",
"python", "rust", "go", "json", "yaml", "markdown",
},
highlight = { enable = true },
indent = { enable = true },
textobjects = {
select = {
enable = true,
lookahead