DEV Community

Akshay Vs
Akshay Vs

Posted on

Managing Monorepos in Neovim with monorepo.nvim

Working inside a monorepo can feel like navigating a labyrinth. Multiple projects, languages, and build systems coexist in the same tree, and the constant context-switching can be exhausting. Developers often juggle file explorers, project managers, and custom scripts just to move efficiently. This is where monorepo.nvim steps in.

What is monorepo.nvim?

monorepo.nvim is a Neovim plugin designed to streamline navigation and management of multiple projects inside a monorepo. It integrates directly with two of the most popular Neovim extensions:

  • Telescope.nvim for fuzzy project selection
  • Neo-tree.nvim for intuitive project navigation

The result is a lightweight but capable workflow: discover, select, and switch between projects without leaving Neovim.

Key Features

1. Automatic Project Discovery

The plugin scans your filesystem to identify projects by looking for familiar configuration files:

  • package.json for Node.js
  • pyproject.toml for Python
  • Cargo.toml for Rust
  • go.mod for Go

Each detected project is labeled with an emoji and a human-readable name extracted from its config file.

2. Telescope Integration

Projects appear in a Telescope picker, complete with metadata and type icons. With one keystroke you can:

  • Jump into a project’s root
  • Open it in Neo-tree
  • Change Neovim’s working directory

3. Neo-tree Navigation

Once a project is selected, Neo-tree displays its structure, letting you explore without friction.

4. Virtual Environment Management

For Python developers, this is where the plugin shines. It automatically detects .venv, venv, or .virtualenv directories, activates the right interpreter, and restarts the LSP. No more manual environment juggling.

5. Configurable and Extensible

  • Exclude directories (node_modules, dist, etc.) to avoid noise
  • Limit search depth for performance in huge repos
  • Add new project types with custom config files and regex patterns (e.g., pubspec.yaml for Flutter, docker-compose.yml for Docker)

6. Cross-Platform Support

Whether you’re on Linux, macOS, or Windows, monorepo.nvim adapts to virtual environments, and path resolution is handled gracefully.

Why It Matters

Many Neovim users already rely on tools like project.nvim or telescope-project.nvim, but these tend to be manual bookmark managers or cwd switchers. monorepo.nvim goes further:

  • It automates discovery instead of relying on manual configuration.
  • It unifies navigation and environment setup in a single workflow.
  • It’s ecosystem-agnostic: Node.js, Python, Rust, Go, and beyond.

This plugin is particularly valuable in polyglot monorepos where you might bounce from a TypeScript service to a Python ML pipeline to a Rust microservice, all without breaking your flow.

Installation

With lazy.nvim:

{
  'akshay-vs/monorepo.nvim',
  dependencies = {
    'nvim-telescope/telescope.nvim',
    'nvim-neo-tree/neo-tree.nvim'
  },
  config = function()
    require('monorepo').setup()
  end
}
Enter fullscreen mode Exit fullscreen mode

Example Configuration

require('monorepo').setup({
  root_dir = vim.fn.getcwd(),
  exclude_dirs = { "node_modules", ".git", "dist", "build", "__pycache__" },
  max_depth = 5,
  match_venv = { ".venv", "venv", ".virtualenv" },
  project_types = {
    nodejs = {
      emoji = "📦",
      config_file = "package.json",
      name_pattern = '"name"%s*:%s*"([^"]+)"'
    },
    python = {
      emoji = "🐍",
      config_file = "pyproject.toml",
      name_pattern = 'name%s*=%s*"([^"]+)"'
    },
    rust = {
      emoji = "🦀",
      config_file = "Cargo.toml",
      name_pattern = 'name%s*=%s*"([^"]+)"'
    },
    go = {
      emoji = "🐹",
      config_file = "go.mod",
      name_pattern = 'module%s+([^%s\n]+)'
    }
  }
})
Enter fullscreen mode Exit fullscreen mode

Usage

Commands:

  • : MonorepoProjects - Open Telescope picker with discovered projects

Keymaps:

  • <CR> - Open selected project in Neo-tree
  • <C-o> - Change Neovim’s working directory
  • <leader>mp - Default mapping to launch the project picker

If you find this plugin useful, visit the monorepo.nvim GitHub repository and consider giving it a star to support its development.

Top comments (0)