VoxelPrismatic / rabbit.nvim

Quickly jump between buffers
56 stars 0 forks source link

Change Directory per Window #15

Closed j-xella closed 4 months ago

j-xella commented 4 months ago

If I understand it correctly, many of Rabbit functionality depend on a current folder. However, sometimes this happens:

It would be nice to be able to associate window/tab/vim session with particular folder (or just generic name) for Rabbit purposes. Ideally, this association would be made via vim variables that could be saved/restored via vim sessions. Then Rabbit would work like this:

  1. If a window is explicitly associated with particular folder or generic name, use that for lists.
  2. If a tab is explicitly associated with particular folder or generic name, use that for lists.
  3. If a vim session (via global variable?) is explicitly associated with particular folder or generic name, use that for lists.
  4. Otherwise, use current default logic of using current window folder for lists
VoxelPrismatic commented 4 months ago

can you elaborate on this?

For the same project, I have several windows open, some of them have different cwd

i actually use rabbit oxide when editing rabbit, and it works like this: image

the "current working directory" refers to where neovim is launched, not where the current file lives. that way, when you have a large project, you only need to start neovim in the parent folder and oxide will handle the rest automatically.

j-xella commented 4 months ago

Actually, I often change the current directory for different windows with commands like :lcd %:h

You are lucky that your project has a nice root folder to rule it all :) I work in a company with a lot of distributed legacy software, all over the place.

So, for example, if I work on InterfaceA, it may require changes to 3 binaries: SenderA, ReceiverA and Broker. The sources for all of those binaries reside in completely different locations - they may even be written in different languages! So, I have nvim with 3 windows open side by side, for each of those components. In each window, I lcd to that component directory. It has the following advantages:

And then my boss asks me to quickly do something on the InterfaceB, consisting of SenderB, ReceiverB and the same Broker. So I quickly open a new tab in the same neovim session, and the story continues ...

Unfortunately, it confuses Rabbit. So, even though I work on the same project, I will have separate oxide/harpoon lists for each window. And, since both InterfaceA and InterfaceB use the same Broker, the broker window will have the same oxide/harpoon lists, even though I work on different projects.

I didn't look into Rabbit's code, but it seems that it uses window's current directory as key to store all its lists. It works OK if you open nvim from the same folder every time, and never do lcd in your windows. But my case is too complicated for Rabbit as it is now. Hence asking for the way to detach from the current folder being the key.

VoxelPrismatic commented 4 months ago

I see. I'll look into it.

VoxelPrismatic commented 4 months ago

Implementation note:

VoxelPrismatic commented 4 months ago

@j-xella After actually testing this, Rabbit works exactly as you described. No additional changes need to be made.