natecraddock / workspaces.nvim

a simple plugin to manage workspace directories in neovim
MIT License
309 stars 15 forks source link

[Feature proposal] Config workspaces folders #17

Closed ValJed closed 1 year ago

ValJed commented 1 year ago

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. ☮️

natecraddock commented 1 year ago

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)

ValJed commented 1 year ago

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.

natecraddock commented 1 year ago

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?

ValJed commented 1 year ago

@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:

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

natecraddock commented 1 year ago

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