Skip to content

Latest commit

Β 

History

113 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nvim Monorepos

A simple and efficient file picker for monorepo projects. This plugin finds all directories containing specific file patterns (like package.json or project.json) and provides a telescope.nvim interface to quickly navigate and search within those projects.

Features

  • πŸ” Project Discovery: Automatically finds project directories based on configurable file patterns
  • πŸ“ File Navigation: Quick file finding within selected projects using telescope.nvim
  • πŸ”Ž Text Search: Live grep functionality within project directories
  • βš™οΈ Configurable: Customizable file patterns and ignore rules
  • πŸš€ Performance: Efficient directory scanning with ignore patterns
  • πŸ“‹ Smart Display: Shows parent directory context and project file indicators for better identification

Installation

Using lazy.nvim

{
  "sajjathossain/nvim-monorepos",
  dependencies = {
    "nvim-telescope/telescope.nvim"
  },
  cmd = {
    "FindFilesInAProject",
    "FindInFilesInAProject"
  },
  config = true
}

With custom configuration

{
  "sajjathossain/nvim-monorepos",
  dependencies = {
    "nvim-telescope/telescope.nvim"
  },
  cmd = {
    "FindFilesInAProject",
    "FindInFilesInAProject"
  },
  config = function()
    require("nvim-monorepos").setup({
      files = { "package.json", "Cargo.toml", "go.mod" },
      ignore = { ".git", "node_modules", "target", "build" }
    })
  end
}

Usage

Commands

Command Description
:FindFilesInAProject Open project picker, then find files in selected project
:FindInFilesInAProject Open project picker, then search text in selected project

Lua API

local monorepos = require("nvim-monorepos")

-- Find files in a project
monorepos.find_files()

-- Search text in project files
monorepos.find_in_files()

Configuration

Default Configuration

{
  files = { "project.json", "package.json" },
  ignore = { ".git", "node_modules", "build" },
  display = {
    show_icons = true,        -- Show file type icons
    show_file_count = false,  -- Show file count instead of file names
    compact_paths = true      -- Use compact path display
  }
}

Configuration Options

Option Type Default Description
files string[] {"project.json", "package.json"} File patterns to identify project root directories
ignore string[] {".git", "node_modules", "build"} Directory patterns to ignore during scanning
display.show_icons boolean true Show file type icons (πŸ“¦ for package.json, πŸ¦€ for Cargo.toml, etc.)
display.show_file_count boolean false Show file count instead of individual file names
display.compact_paths boolean true Use compact path display (parent/project format)

Example Configurations

For JavaScript/TypeScript projects

require("nvim-monorepos").setup({
  files = { "package.json", "tsconfig.json" },
  ignore = { ".git", "node_modules", "dist", ".next" }
})

For Rust projects

require("nvim-monorepos").setup({
  files = { "Cargo.toml" },
  ignore = { ".git", "target", "node_modules" }
})

For Go projects

require("nvim-monorepos").setup({
  files = { "go.mod" },
  ignore = { ".git", "vendor", "bin" }
})

For mixed language monorepos

require("nvim-monorepos").setup({
  files = { "package.json", "Cargo.toml", "go.mod", "pom.xml" },
  ignore = { ".git", "node_modules", "target", "vendor", "build" }
})

Custom display options

require("nvim-monorepos").setup({
  files = { "package.json", "Cargo.toml" },
  ignore = { ".git", "node_modules", "target" },
  display = {
    show_icons = true,        -- Show icons: frontend/web-app β”‚ πŸ“¦ package.json β€’ πŸ”· tsconfig.json
    show_file_count = false,  -- Or show count: frontend/web-app (2 files)
    compact_paths = true      -- Use parent/project format for long paths
  }
})

Minimal display (no icons)

require("nvim-monorepos").setup({
  files = { "package.json" },
  display = {
    show_icons = false  -- Plain format: frontend/web-app [package.json, tsconfig.json]
  }
})

How It Works

  1. Scanning: The plugin recursively scans your current working directory
  2. Filtering: Directories are filtered based on ignore patterns
  3. Project Detection: Directories containing any of the specified file patterns are identified as projects
  4. Selection: Telescope picker shows all found projects for selection
  5. Action: Selected project opens telescope's file finder or live grep

Requirements

License

MIT License - see LICENSE file for details.

About

simple telescope file finder for monorepos

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages