natecraddock / workspaces.nvim

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

Option to change local instead of global path #2

Closed maxmahlke closed 2 years ago

maxmahlke commented 2 years ago

Nice plugin! I have tried it out and prefer it over telescope-project as yours is more configurable.

One option I would like to see is to make the path change when opening a workspace local instead of global. I like to have one tab per project/workspace open in nvim, so global path changes are a bit of a nuisance to me.

It could be a plugin option à la use_local_path=True. I saw that you're using nvim_set_current_dir for the path changes, which does not seem to have a local alternative, so maybe something like vim.cmd[[lcd path/to/workspace]]?

natecraddock commented 2 years ago

Yeah I think that should be a simple fix! I'll give it a try later today and make a branch so you can test it out, since I'm not 100% sure exactly what your workflow is :)

natecraddock commented 2 years ago

Give the localcd branch a try. The readme has been updated. I tested myself and it seems to work, but let me know if something isn't right.

maxmahlke commented 2 years ago

Hi Nate, thanks for the quick response, it works great! Looks good for the master branch to me.

Just FYI, here's my current config, it just opens a new tab whenever I switch project.

require("workspaces").setup({

    global_cd = false,

    hooks = {
        open_pre={"tabnew"},
        open = {"Telescope find_files"}
    }
})

Next step for my config is to automatically rename the tab to the project/workspace name and afterwards, when switching projects with this plugin, it should find the tab and switch to it rather than creating a new one. It's not too ambitious, just right for my lua skills.

Thanks again!

natecraddock commented 2 years ago

Glad it works! I just merged to master (along with a deprecation, see the changelog for details). Good luck with your workflow, and let me know if you might need any other features!