1.4 KiB
1.4 KiB
tiny-rooter.nvim
A tiny project root detector for Neovim 0.12+. Automatically sets the local working directory to the project root when opening a file.
Zero config. ~15 lines of Lua.
Features
- Auto-detects project root via marker files
- Sets local working directory (
lcd) per window - Ships with a comprehensive default marker list
- Configurable markers for custom project structures
- Works out of the box — no setup call required
Requirements
- Neovim >= 0.12
Installation
Add to your vim.pack.add() call:
"https://github.com/swaits/tiny-rooter.nvim",
Done. The plugin auto-loads with sensible defaults.
Configuration
All options are optional. Call setup() only if you want to customize:
require("tiny-rooter").setup({
markers = { ".git", ".jj", "Cargo.toml", "pyproject.toml", "Makefile", "go.mod", "package.json" },
})
Default markers
The default marker list covers most common project types:
| Marker | Ecosystem |
|---|---|
.git |
Git repositories |
.jj |
Jujutsu repositories |
Cargo.toml |
Rust |
pyproject.toml |
Python |
Makefile |
C/C++ and general |
go.mod |
Go |
package.json |
Node.js |
How it works
On BufReadPost and BufNewFile, the plugin calls vim.fs.root() with
the configured markers. If a root is found, it runs lcd to set the
window-local working directory.