Skip to content

Dr-42/project-manager.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Project Manager.nvim

License: BSD-2-Clause

Project Navigator.nvim is a Neovim plugin that helps you quickly browse and open your projects. It uses Telescope.nvim for a smooth fuzzy-finding interface and nvim-web-devicons to display icons based on the dominant file type in each project.

Features

  • Configurable File Extensions: Users supply their own list of allowed file extensions.
  • Customizable Ignored Directories: Choose which directories to ignore when scanning for projects.
  • Multiple Project Roots: Easily map additional project roots to keybindings.
  • Telescope Integration: Browse projects using Telescope’s interface.
  • Dynamic Icons: Each project displays an icon based on its most common file extension.

Prerequisites

Installation

Using Lazy.nvim

Add the following to your Lazy configuration (e.g., in your lazy.lua):

return {
  {
    "Dr-42/project-manager.nvim",
    name = "project-manager",
    dependencies = {
      "nvim-telescope/telescope.nvim",
      "nvim-tree/nvim-web-devicons",
    },
    config = function()
      require("project_navigator").setup({
        projects_root = vim.env.HOME .. "/Projects",  -- Your projects directory
        allowed_exts = { "lua", "py", "js", "ts", "cpp" },  -- Customize your allowed file extensions
        ignore_dirs = { "probe", "third_party" },            -- Directories to ignore
        extra_mappings = {                                    -- Optional extra mappings
          probe = vim.env.HOME .. "/Projects/probe",
          third_party = vim.env.HOME .. "/Projects/third_party",
        },
      })
      vim.keymap.set("n", "<leader>p", require("project_navigator").open_projects, { desc = "Open Projects" })
      vim.keymap.set("n", "<leader>pp",
        function()
            require("project_navigator").open_project_by_key('probe')
        end,
        { desc = "Open Probe Projects" })
    end,
  },
}

Usage

Once installed, you can open the projects picker with the keybindings you set

  vim.keymap.set('n', '<leader>wso',
    require('project-manager').open_projects,
    { desc = '[W]ork[S]pace [O]pen' })
  vim.keymap.set('n', '<leader>wsp',
    function()
      require('project-manager').open_project_by_key("probe")
    end,
    { desc = '[W]ork[S]pace [P]robe' })
  vim.keymap.set('n', '<leader>wst',
    function()
      require('project-manager').open_project_by_key("third_party")
    end,
    { desc = '[W]ork[S]pace [T]hird Party' })

How It Works

  • Scanning Projects: The plugin scans the specified projects_root directory. For each subdirectory, it uses Git to list files and determines the most common file extension based on your allowed list. If not a git repo, It scans all files.
  • Icons: It then uses nvim-web-devicons to fetch an icon corresponding to that file extension.
  • Telescope Picker: Finally, a Telescope picker displays your projects with their icons and names. When you select a project, it changes the working directory to the project folder and opens it.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests. Please follow the repository’s guidelines. License

This project is licensed under the BSD-2-Clause License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published