nvim-bundle
Statically link a Neovim plugin's Lua modules into one file.
nvim-bundle resolves require 'literal' calls at build time, so the generated
file calls bundled module functions directly. Module sources stay Lua code, so
LuaLS and EmmyLua annotations remain visible. Calls the linker cannot resolve
stay ordinary host require calls. The generated file returns the module you
name, as require would, or a registry of lazy loaders when you name none.
Requirements
- Neovim 0.10 or newer
- A LuaJIT-based Neovim (the default)
- Neovim's bundled Lua tree-sitter parser
Official builds include the Lua parser. A custom build with
USE_BUNDLED_TS_PARSERS=OFF needs an ABI-compatible parser on the runtime path.
Install
Install nvim-bundle with mise, which downloads the
release, verifies its checksum, and puts nvim-bundle on PATH:
mise use -g \
'github:jrop/nvim-bundle@0.5.1'
Drop -g to pin the version in a project's mise.toml instead, so everyone
who works on that project runs the same nvim-bundle.
Without mise, download the executable from a release. It is one file, and it
needs only Neovim to run:
version=v0.5.1
base="https://github.com/jrop/nvim-bundle/releases/download/$version"
curl -fsSLo nvim-bundle "$base/nvim-bundle"
curl -fsSLo nvim-bundle.sha256 "$base/nvim-bundle.sha256"
sha256sum -c nvim-bundle.sha256 # or: shasum -a 256 -c nvim-bundle.sha256
install -m 755 nvim-bundle ~/.local/bin/nvim-bundle
To run from a checkout or vendor the bundler itself, see
Install nvim-bundle.
Once it is installed, one command vendors a library into your plugin. An
example is guard.nvim:
nvim-bundle install jrop/guard.nvim guard
This writes lua/<your-plugin>/vendor/guard.lua, so your code loads it with
require '<your-plugin>.vendor.guard'. See
Vendor a dependency for pinning and other
options.
Tutorial: build your first bundle
In this tutorial, we will create a small plugin, bundle it, and load the
generated file. We will use the nvim-bundle command from PATH.
Create a scratch plugin:
mkdir -p demo-plugin/lua/demo
cd demo-plugin
cat > lua/demo/init.lua <<'EOF'
local util = require 'demo.util'
return { greet = util.greet }
EOF
cat > lua/demo/util.lua <<'EOF'
local M = {}
function M.greet(name)
return 'hello, ' .. name
end
return M
EOF
Bundle the entry module:
nvim-bundle build demo
The output should look like:
bundled 2 modules into dist/demo.lua (returns demo)
Load the generated file in Neovim:
nvim --clean --headless \
+'lua print(dofile("dist/demo.lua").greet("world"))' \
+'qa!'
Neovim prints:
hello, world
Open dist/demo.lua. Notice that the require in demo/init.lua became a
direct call to the bundled demo.util module, and that the file contains one
function per module. For why that shape preserves types and what stays
dynamic, see
How static linking works.
The generated file returns demo's value, just as require 'demo' would
for the source tree, so it is a drop-in replacement for lua/demo/.
We have built a bundle from two modules and loaded it without installing the
plugin.
For a library with several entry points, run nvim-bundle build with no
module to get a registry of every module instead; see
Bundle a library with several entry points.
For a command-line tool, pass --bin to make the file executable. See
Build an executable bundle.
Documentation
| I want to... |
Read |
| Bundle a plugin, build an executable, or use the Lua API |
How-to guides |
| Look up commands, options, module ids, or errors |
Reference |
| Understand static linking, executable bundles, and type propagation |
Explanation |
License
MIT License
Copyright (c) 2026 Jonathan Apodaca
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.