vim-fern icon indicating copy to clipboard operation
vim-fern copied to clipboard

[Feature] Add the ability to retain the open/closed status of the fern drawer between tabpages

Open ydzhou opened this issue 1 year ago • 3 comments

We can provide a feature to mimic the behaviour of a typical IDE's file explorer.

If I open a Fern drawer in current tab, and then I switch to other tab, the Fern drawer will automatically toggle to open, and vice versa. nvim-tree has a very similar feature.

ydzhou avatar Mar 16 '23 00:03 ydzhou

Why the feature is needed? This feature is so useful? I think mimic the behavior of IDE is not the reason.

Shougo avatar Mar 16 '23 00:03 Shougo

It is a common feature, similar to (or a simplified version of) vim-nerdtree-tabs or nvim-tree.tab.sync. This new feature can save a lot of time to toggle on/off Fern across tabs.

For example, without this feature, if I do open in new tab, then in the new tab, I need to toggle Fern again to see my files and continue explore. I may do open in new tab again, then I need to toggle Fern again.

I previously proposed a feature about universal fern, but then now I realize I do not need a single global Fern in every tabs, I just need Fern always show up or always close for every tabs.

ydzhou avatar Mar 16 '23 01:03 ydzhou

OK, I tried to do it using the tip. But Fern behaves very weird. Can you reproduce?

My config

augroup FernOpenInAllTabs
  autocmd! *
  autocmd TabEnter * ++nested Fern . -drawer
augroup END

Step to produce:

  1. Open vim
  2. Toggle Fern drawer
  3. Open new tab :tabnew
  4. Fern shows up empty and take half of my vim window

ydzhou avatar Mar 16 '23 05:03 ydzhou