nvim-plugin-template
Template repository for building and releasing Neovim plugins with tests and CI.
Last synced:
Template metadata
README
myplugin.nvim
A Neovim plugin that does something useful.
Features
- Feature 1
- Feature 2
Requirements
- Neovim 0.8+
Versioning
- Canonical project version is stored in
VERSION. release-pleaseupdates bothVERSIONandCHANGELOG.md.
Installation
-- lazy.nvim
{ "YOUR_USERNAME/myplugin.nvim", opts = {} }
-- packer.nvim
use { "YOUR_USERNAME/myplugin.nvim", config = function() require("myplugin").setup() end }
Usage
:Myplugin
Configuration
require("myplugin").setup({
greeting = "Hello from myplugin!",
})
Options
| Option | Type | Default | Description |
|---|---|---|---|
greeting |
string |
"Hello from myplugin!" |
The greeting message |
Development
Getting Started from Template
- Click "Use this template" on GitHub to create your repo
- Clone your new repo
- Search and replace
mypluginwith your plugin name:# Preview what will change grep -r "myplugin" --include="*.lua" --include="*.md" --include="Makefile" -l # Rename files mv lua/myplugin lua/YOUR_PLUGIN_NAME mv plugin/myplugin.lua plugin/YOUR_PLUGIN_NAME.lua # Replace in file contents (macOS) find . -type f \( -name "*.lua" -o -name "*.md" -o -name "Makefile" \) -exec sed -i '' 's/myplugin/YOUR_PLUGIN_NAME/g' {} + # Replace in file contents (Linux) find . -type f \( -name "*.lua" -o -name "*.md" -o -name "Makefile" \) -exec sed -i 's/myplugin/YOUR_PLUGIN_NAME/g' {} + - Update
README.md— replaceYOUR_USERNAME, write your own description and features - Choose your license (MIT is included by default)
Testing
Tests use mini.test. Run them with:
make test
Or manually:
MINI_PATH=/path/to/mini.nvim \
nvim --headless -u tests/minimal_init.lua \
-c "lua MiniTest.run({})" -c "qa"
Linting
make lint
Formatting
make format # auto-format
make format-check # check only (CI uses this)
Documentation (:help)
Plugin help is generated from Lua annotations in lua/myplugin/init.lua using
mini.doc:
make docs
make docs injects the current value from VERSION into the
generated vim help file.