This is an automated archive made by the Lemmit Bot.
The original was posted on /r/neovim by /u/Suitable-Smile-2663 on 2023-11-04 19:28:58.
Key Features
- Automatic sessions.
- Automatic project root detection.
- Sorted by last used project history.
- Sync across multiple devices.
- Quick Session Switching with Telescope.
Project root detection
You might wonder how it’s possible to detect project roots. Determining the project root can be a challenging task, given the diversity of project structures and the absence of a universal solution. Projects vary significantly in terms of technology, directory structure, and nesting. Some projects may not even use version control systems or contain files in the root directory.
However, you can tackle this challenge by defining directory structure rules for project identification. Specify these rules in the plugin configuration and adhere to them, or modify them as needed.
Here’s an example of such rules:
lua projects = { "~/work/*", "~/.config/*", "~/projects/*", "~/projects/repos/*", },
Project roots matching these rules:
~/work/project_iguana ~/work/project_lizard ~/.config/nvim ~/.config/i3 ~/projects/project_elephant ~/projects/repos/aur_elephant
Sessions
After resolving the project root detection challenge, session management becomes a more straightforward task. Neovim features a session mechanism, and there is already a plugin, “neovim-session-manager,” to simplify session management. This plugin is in dependencies.
Syncing Across Devices
The issue of syncing projects between different devices starts long before this plugin, so you’ve probably already solved it for yourself in one of many ways. But in order for sessions and project history to be independent of the operating system and username, the plugin must store paths in a special manner. My plugin stores them relative to the home directory, so it doesn’t matter where your home directory is on which device, as long as you store your projects there. The responsibility for synchronization across devices lies with the user.
vim-startify and others
People who have used such plugins as Startify often want to use them together with my plugin. While it is possible to do so, it’s not worth it. Neovim project manager can open your previous project on startup, also it can open your second most recent project in a single keybinding, and open any other plugin via Telescope.
When you open some project, you have all opened tabs restored. This is very convenient. If you want to open a new file, you can do it with :Telescope find_files
.
Dotfiles as Projects
You can use your dotfiles as projects. Just add ~/.config/*
to your projects list and you can open your app config as a project. For instance, when you need to edit your Hyprland configuration, just search a project by hyp
in Telescope. You will open the exact file(s) you previously edited in the same context.
Installation and Configuration
To install and configure the Neovim Project Manager, please follow the instructions provided on the GitHub page.
My personal impression after transition from JetBrains IDEs
I have been using JetBrains IDEs for a long time, I greatly appreciated their features. However, I was frequently frustrated by the time it took for the IDE to start and load projects.
With Neovim and this plugin, I can open any project in a 200ms. It’s much more convenient to split my projects to small pieces and to work with them. I no longer need to navigate through extensive folder trees in a file explorer; I rely on Telescope extensively. Notably, this approach significantly reduces my computer’s RAM usage, and I can edit text efficiently without relying on a mouse or touchpad.
A few words about tmux
The Neovim Project Manager can be used alongside tmux, and they complement each other. However, I personally don’t use tmux, as my tiling window manager fulfills all my requirements.
Conclusion
For those seeking an enhanced Neovim experience and efficient project management, the Neovim Project Manager is a valuable addition to the toolkit. Its features and adaptability make it a compelling choice for developers looking to optimize their workflow and make the most of Neovim’s capabilities.
Feel free to explore this versatile tool and discover how it can elevate your Neovim experience.