nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

No different buffers in different tabs

Open LouisTrinczek opened this issue 3 years ago • 14 comments

Hey, when I create a new tab in Nvim, with the :tabnew command, and open Nvim Tree in both tabs.

When I now open for example a frontend directory in one tab, and go into a backend directory in the other tab, it goes into the backend directory in both tabs.

Is this wanted or is this a bug, and is there a way to change this behavior?

LouisTrinczek avatar Jun 17 '21 16:06 LouisTrinczek

currently there is only one buffer for the tree, i do not keep track of multiple tree instance under multiple paths, although it could be made easily i think

kyazdani42 avatar Jun 28 '21 18:06 kyazdani42

Right now how I do it is to have multiple terminal tabs open. But this isn't really the way to go i guess. It works for now, but is kinda annoying on fullstack projects. :)

LouisTrinczek avatar Jun 29 '21 11:06 LouisTrinczek

I could work out something i guess, but this might lead to new issues that i might not want :)

kyazdani42 avatar Jun 29 '21 19:06 kyazdani42

I would also like to request the ability to have a separate state for each tab. Having a different root or open / closed state in the tree for different tabs is something I use pretty often.

Maybe a setting like sync_between_tabs to turn it on or off.

eirabben avatar Aug 12 '21 07:08 eirabben

Yeah, before I migrated to nvim-tree, I used defx and as one example, would often open multiple defx buffers to do things like copy and paste files to a different directory

svermeulen avatar Feb 09 '22 19:02 svermeulen

I have a few refactorings to do in order to implement this, because 1) the view buffer is loaded only once during startup (which was one of my worst design choice...) and 2) i have only 1 global variable for managing the explorer state.

kyazdani42 avatar Feb 09 '22 20:02 kyazdani42

There are now multiple tree buffers, so each tab retains its own state.

Please reopen if you have any further questions or bugs.

alex-courtis avatar Apr 03 '22 05:04 alex-courtis

@alex-courtis i believe it does not ? There is still only one tree state for all buffers

kyazdani42 avatar Apr 03 '22 12:04 kyazdani42

@alex-courtis i believe it does not ? There is still only one tree state for all buffers

~~Whoops. Either way, the nvim-tree in each tab has its own state and is not affected by the others.~~

NvimTreeRefresh does still cause unexpected behaviour across tabs, such as collapsing parts of the tree. Such behaviour is inconsistent. Reopening.

alex-courtis avatar Apr 03 '22 23:04 alex-courtis

Can I configure auto_sync_buffers cross all of the tabs?

mario-amazing avatar May 28 '22 14:05 mario-amazing

Can I configure auto_sync_buffers cross all of the tabs?

Not sure what you mean by that... is there something you could quickly put together to demonstrate?

alex-courtis avatar May 29 '22 01:05 alex-courtis

@alex-courtis, I have 2 opened Nvim tabs. After updating one tab I want to have the same situation in the second tab.

https://user-images.githubusercontent.com/9537753/170888264-7df6117a-f138-4d4b-982a-7d8a8e6d976f.mov

mario-amazing avatar May 29 '22 19:05 mario-amazing

I see. Desired functionalities:

  • One nvim-tree across multiple tabs, with identical / mirrored state
  • Completely separate nvim-trees for each tab, with their own state that does not affect others

This is a non-trivial amount of effort.

alex-courtis avatar May 30 '22 01:05 alex-courtis

See #877

alex-courtis avatar Jun 11 '22 02:06 alex-courtis

See #1847 for ideas on tcd vs lcd.

alex-courtis avatar Jan 01 '23 21:01 alex-courtis

I see. Desired functionalities:

  • One nvim-tree across multiple tabs, with identical / mirrored state
  • Completely separate nvim-trees for each tab, with their own state that does not affect others This is a non-trivial amount of effort.

Also, I see this thread: https://github.com/nvim-tree/nvim-tree.lua/discussions/1847#discussioncomment-4567184

Just to add a voice, my personal use-case for multi tab is using tabs to manage collections of buffers in the same project / git repo. So I'd ideally see independent nvim-trees per-tab (because each tab represents a collections of files which may or may not live in the same local dir, but do all exist in the same cwd) but the tree would be using the same cwd across all tabs.

lougreenwood avatar Apr 14 '23 09:04 lougreenwood

Tracking at

  • #2255

alex-courtis avatar Jun 04 '23 02:06 alex-courtis