natecraddock / workspaces.nvim

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

(Recipe) Automatically change workspace when changing buffers #25

Closed 0x0013 closed 1 year ago

0x0013 commented 1 year ago

I normally use a single neovim instance and work in different projects (workspaces) in it.

This would present an issue when switching to a different pane/buffer belonging to a different workspace. The old workspace would still remain active, so any actions (such as telescope search) would be constrained to the other workspace, unless I were to manually switch.

So I created an autocommand to do this automatically when switching buffers, unless the file is already in the current active workspace. Please consider if this would be worthwile including in the wiki.

Implementation can be seen in my forked wiki repo.

natecraddock commented 1 year ago

Sorry I didn't realize the wiki was not public! I just made it public.

But I went ahead and added your suggestion to the wiki. Thank you!