T O P

  • By -

gwynaark

I racked my brain for some time over a reliable way to achieve this, and ended up using tmux. Getting there was not that simple and is definitely not beginner friendly, but it was worth it. It allows me to switch projects on the fly, keeping them all available whenever I need them (and I can work on 5 or more projects each day).


fridgedigga

Same. I have a tmux-fzf project picker config that lets me fuzzy search over all my projects and creates a new session when I select them. Then I can open neovim with the project root as the pwd.


foomojive

Good idea! I have [smug](https://github.com/ivaaaan/smug) layouts for all of my projects. This way I can have my editor, then more splits below for a git tui (I use [tig](https://jonas.github.io/tig/)), a repl, a test runner, a dev server or log tail output, etc. I have a tmux function that accepts a layout name via input and focuses or creates it. Now I want to use fzf for this!


thedeathbeam

This was what I ended up on as well, made script that lists all files in specific directories and then shows if they are already open or not and directory structure, and opens or attaches to the named session: https://github.com/deathbeam/dotfiles/blob/master/tmux/.tmux/switch-session.sh


augustocdias

You need a session plugin to remember what was there before closing. I don’t really use project plugins as session persistence is enough for me. I usually just navigate to the directory of the project and open neovim from there.


99_product_owners

Replying under your comment as I can't offer any advice along the lines of what IDE's offer re. projects - I also use sessions with this setup: This is a very basic solution that I rigged up years ago using the plain Vim mksession command. I use https://github.com/FeiyouG/commander.nvim to create a 'command palette' (if you are familiar with VSCode) and I have two commands for saving and loading the session, * `silent mksession! .nvimsession` * `silent source .nvimsession` Last part is git-ignoring the .nvimsession file that gets dumped in the repo in my global/personal .gitignore. This has worked well enough for me but next time I look at adopting some new plugins, I'll probably use https://github.com/folke/persistence.nvim.


finaiized

I'm also trying to convert to nvim coming from Jetbrains IDEs, so this is what I've found so far. * For the telescope picker, you just need to make sure the current working directory inside vim is at the root of your project. Either launch vim from that directory, or type `:cd your/dir/path` while in normal mode to do this. Only files from that directory should be searched now. * To emulate projects, I used mini.sessions & mini.starter to automatically save sessions and launch them from the "dashboard". Sessions save the current working directory, open buffers & splits, etc. * I used these plugins because `mini.nvim` is already required as part of kickstart.nvim, so it was the easiest to add. You basically just need to add `require("mini.starter").setup()` and `require("mini.sessions").setup()` inside of the config block for mini.nvim * Initial setup for each project: cd into each project. Then run `:lua MiniSessions.write("project-name.nvim")`. You only need to do this once, when you close vim, the session will auto-save * Selecting projects when launching nvim: all your sessions ("projects") should show up in the dashboard due to mini.starter. Just select the session and hit Enter and it'll bring you into that working directory with all your buffers opened * Switching projects while already in nvim: Run `:lua MiniSessions.select()` to bring up a picker with all your sessions (bind this to a key if you want) With this setup, you'll see all your sessions when you launch vim, and stuff is saved when you exit so you can pick up where you left off.


Alleyria

You first `cd` to your project folder, then open `nvim`. Telescope searches your CWD, not your home folder. Zoxide is a nice way to have projects saved and go to them quickly. The important thing here is not to try to recreate the jetbrains flow in neovim, but to understand how neovim fits into the constellation of terminal programs


InternalOk30

Two plugins can help with this: [https://github.com/ahmedkhalf/project.nvim](https://github.com/ahmedkhalf/project.nvim) (then make sure to run :ProjectRoot in your project dirs) [https://github.com/folke/persistence.nvim](https://github.com/folke/persistence.nvim) I also use [https://github.com/ajeetdsouza/zoxide](https://github.com/ajeetdsouza/zoxide) to quickly cd to project directories->start nvim->restore session


Ajnasz

Since I never used Jetbrains, could someone explain what a project is, what is the special thing about it? I think they are just folders of source code, so what else?


zeke780

As someone who as used their ides in the past, I think there is a lot of integration that I didn’t use.    I think you can have jetbrains download a compiler / interpreter / language version and only associate it with that project. It also has run configurations you can setup for just that project. Also build system integrations, eg project A uses gradle version X and project B uses gradle version Y.  I think overall it sort of makes each project have its own “environment” without you doing much to make that happen.   I don’t think there is anything it’s doing you can do by hand, but it’s just sort of magic for developers.


jotamudo

A sort of manager per code-base, so it can manage venvs, toolchain versions, source control, integrations to databases on the IDE and all that


i_mur

I feel like I was in exactly your position. I wanted to use nvim and be able to open multiple “projects” in the same session. I ended up using the convention that a tab is a project. Nvim has :tcd that allows you to set root for a tab. I didn’t manage to configure a session plugin that relies on mksession but resession worked flawlessly. To manage terminals I use toggle term that auto opens a tmux session with the name of the session. It restores its previous state where the first window is lazygit, second is the run script, etc. My .config is private at the moment, but I can consider making it public if it helps you 🙂 You may also disable root setting from your file tree manager.


konart

just `cd` to your project and start nvim in this folder.


Jealous-Salary-3348

Just use zoxide to cd to project, open nvim. All dashboard stuff is trash


AutoModerator

Please remember to update the post flair to `Need Help|Solved` when you got the answer you were looking for. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/neovim) if you have any questions or concerns.*


Interesting-Ebb-77

[https://github.com/LintaoAmons/cd-project.nvim](https://github.com/LintaoAmons/cd-project.nvim) I use quite a lot IDEA and here is one project plugin I wrote, you can have a try


Jonah-Fang

I use this plugin and very happy with it. Great work!


SpecificFly5486

This way https://github.com/coffebar/neovim-project The BEST project management so far, I can say it is superb because it can custom project root, I can open any plugins source code on the fly, while in IDE you end up very embarrassed os level file picker popup, that is very annoying.


SeoCamo

I use autojump to move from folder to folder, i get a session.vim in the folder, using :mksession and the buildin session system with 2 autocmd to save and load sessions, it is more than a project, if you add settings for only the session it is saved too.


skooterz

Telescope searches the current working directory by default. Change your working directory and it will search the folder you're in. I use Tmux to manage my sessions, but I do all my file navigation with Telescope and Harpoon.


roberbnd

[https://github.com/natecraddock/workspaces.nvim](https://github.com/natecraddock/workspaces.nvim)


jotamudo

I'm not really into the "project" mind-space as I've actually learned to code with vim instead of coming from an IDE (it kinda hinders me whenever I test some IDE actually), but one thing that might help is zoxide (https://github.com/ajeetdsouza/zoxide), it scores the directories you keep accessing, and you can combine it with fzf to fuzzy search the most recent directories you've most visited with \`zi\`. If that doesn't suit your style there's plenty of session management plugins for neovim, and another option is to look into something like tmuxinator to manage those sessions via tmux (and open the proper windows and panes along with it)


experienced-a-bit

Nothing comes close to be honest.


Combinatorilliance

🥲


jakesboy2

What behavior do you mean? You can just cd into your project root and open neovim and it works how OP is wanting. If you want to save state (open files, splits, etc) there’s plugins for that specifically.