DEV Community

Saltaformajo
Saltaformajo

Posted on

Boost Your Productivity with This Neovim Plugin for Project Management!

Introduction

Neovim, with its extensible architecture and plugin ecosystem, holds immense potential to transform into an exceptional IDE (PDE). If you've ever experienced the struggles of navigating between projects in traditional IDEs, you know how sluggish and cumbersome it can be. The frustration of switching contexts and dealing with delays often leads us to haphazardly bundle projects into a single chaotic workspace.

Neovim, however, offers a refreshing change. It introduces a world of possibilities:

  • The built-in :mksession command allows you to save and restore the current state of the editor.
  • There are various plugins tailored for project management.
  • tmux (You will use a separate instance of Neovim for each project)

The first option, using :mksession, is functional but requires some manual effort to streamline your workflow. Fortunately, many plugins have put in significant work to make your life easier. As for tmux, it can be customized, but configuring it to be unobtrusive and seamless is no small task. Moreover, Neovim already incorporates many features offered by tmux, eliminating the need for redundancy.

The most efficient and convenient choice is utilizing Neovim plugins. I've experimented with a few, and I'm excited to share my experiences with you.

Neovim Session Manager

Neovim Session Manager is a popular plugin, that uses built-in :mksession command. It simplifies the process of saving and restoring sessions by implementing auto-commands and user-commands. This plugin can automatically save your session when you close Neovim and restore it the next time you open it.

It is stable and well-maintained, but it is not an all-in-one solution for project management.

UI

Uses vim.ui.select()

Project.nvim

Project.nvim is a plugin that aims to provide a simple and intuitive project management experience. Unfortunately, it can't save sessions like Neovim Session Manager, and can't work in tandem with it. The main function of the Project.nvim is to detect project root by patterns and LSP, but this task is quite challenging and sometimes it misses. This project has a lot of opened PR. It seems that developer is not interested in these changes or is no longer interested in supporting this plugin.

UI

It uses a Telescope:

img

Neovim Project

Neovim Project bridges the gap and addresses the challenges of comprehensive project management. It not only works seamlessly with Neovim Session Manager but also incorporates it as a module. Therefore, when you install Neovim Project, you also acquire Session Manager, eliminating the need to configure two separate plugins.

UI

It uses a Telescope:

  • img

Configuration and project structure

Neovim Project encourages a structured and organized approach to project management. It adopts a declarative project structure, requiring you to decide in which directory your projects should be placed. This effectively resolves the issue of determining project root directories and enables the plugin to automatically discover all your projects as soon as you create a single project directory. You have the flexibility to categorize projects by context, programming language, or any other criteria, depending on the masks you add to the plugin's configuration. It even supports nested projects.

Here's an example of my configuration:

  opts = {
    projects = {
      "~/proj/work/*",
      "~/proj/github/*",
      "~/proj/aur/*",
      "~/.config/*",
    },
  },
Enter fullscreen mode Exit fullscreen mode

Here is another interesting thing. Project's README suggests adding .config/* mask. This is an excellent idea, as it allows you to see your Neovim configuration as a project. This is particularly useful for editing other dotfiles. For instance, you can open a project like bspwm to quickly locate and edit your bspwmrc file.

Keybindings

I have set up three keybindings for Neovim Project. These keybindings trigger the following commands:

  • :Telescope neovim-project history - This command allows you to select a project from your recent history.

  • :Telescope neovim-project discover - Use this command to find a project based on patterns.

  • :NeovimProjectLoadRecent - This command is used to open the previous session.

The most frequently used command among these is the first one (history). I use it to switch between projects with Telescope fuzzy finder. It displays projects sorted by access time. However, it won't show a project until it has been accessed at least once. To address this, I use the discover command.

NeovimProjectLoadRecent command is invaluable when you need to swiftly return to the previously accessed project, whether for reference or to copy something.

Conclusion

Efficiency and organization are at the core of every developer's success. The right tools and plugins can significantly enhance your productivity and project management. With Neovim ecosystem, you have the power to create a tailored development environment that meets your specific needs. Whether you opt for Neovim Session Manager, Project.nvim, or Neovim Project, each plugin brings its unique strengths to the table. Choose the one that aligns with your workflow and enjoy a more streamlined, efficient, and organized coding experience. Happy coding!

Top comments (0)