natecraddock/workspaces.nvim

[Feature proposal] Config workspaces folders

Closed this issue · 5 comments

Hello,

First of all thanks for this useful plugin!!
I'm using it since few days and I really like it.
To explain my proposal first some context:
I'm used to store my projects in few places (like perso / pro)
And these folders are only composed of projects (or workspaces) but they change often, I clone a lot of projects, remove them etc.
And I noticed that I don't think to add them manually each time.
I don't want any automatic tracking like does project.nvim because I tried already and it ends with really weird unwanted projects in the list.
Based on that I think it would be really valuable, pretty easy to implement to add a list of folders in the config where each folder is a workspace.
To avoid logic to run at every nvim startup time we could just add a sync method for example that would sync workspaces based on what's currently in the folders workspaces.

Let me know what you think about it, if you ok with the idea I can give it a shot. ☮️

Hi @ValJed let me make sure I understand

You want to add a folder perso and then have workspaces.nvim automatically add all direct subfolders of that folder as a workspace?

Something like

:WorkspacesAdd --dir perso or :WorkspacesAddDir perso

And then each time you start up nvim it checks that directory and updates the list of workspaces to match that dir (adding/removing workspaces as needed)

Hi @natecraddock

Yes this is the point,
my first idea was to add workspaces directories paths to the config but it can be a command of course, it's maybe easier to manage this way.

And the sync could be done at nvim startup time, or if we want to avoid unnecessary processes running at every startup time we could add a command to sync workspaces from directories like WorkspaceSyncDirs.
Both would work I guess.

At first I thought this could probably be done relatively easily with an autocommand in your personal config. But I realized there would actually be some tricky cases to handle without me exposing more of the internals of the plugin. So I'm happy to add support to the plugin for this case. I think it's a useful and small scoped enough to add.

I looked at the code and I already have a good plan to add the feature. You mentioned wanting to try adding the feature. Are you interested in adding it yourself, or would you rather that I do it?

@natecraddock Great, yes since I'm asking for this feature, my pleasure to implement it myself.
Just to be sure we're on the same line:

  • A new command :WorkspacesAddDir perso that will save every sub folder as workspaces. Should it be run in the specific folder or a path could be added?
  • Do we choose to sync at startup time or when a specific command is ran?

If you have more info for me before I start tackling it let me know!

I really don't mind how you choose to implement it. I can see several possible implementations. Do what you think is best!