Writing Neovim plugins
:h lua-plugin (https://neovim.io/doc/user/lua-plugin/) is the authority on
layout, setup() patterns, <Plug> mappings, guard variables, health checks
and deprecation. Read it rather than working from memory — it is opinionated
and it changes. This skill only records what it leaves out.
Style
Per .stylua.toml: 2-space indentation, double quotes, 120-char width,
requires sorted by stylua.
Tooling
- vimdoc: author in Markdown, generate with
panvimdoc, then:helptags doc/. - Types: annotate the public API with LuaCATS and run
lua-typecheck-actionin CI, so luals catches breakage before users do. - Releases: SemVer via
luarocks-tag-releaseorrelease-please-action. Publish to luarocks when the plugin has Lua dependencies or is one itself.
Development loop
:restartreloads plugin changes.nvim --startuptime /tmp/nvim-startup.logto check what eager loading inplugin/costs.