From 0b8c141642127cebbb8b9e78e7b428e28f14a2c3 Mon Sep 17 00:00:00 2001 From: Yudi Zhou Date: Sat, 19 Mar 2022 13:16:19 -0700 Subject: [PATCH 1/3] Create universal fern tree --- autoload/fern.vim | 1 + autoload/fern/internal/command/fern.vim | 3 +++ autoload/fern/internal/viewer/auto_duplication.vim | 2 +- doc/fern.txt | 9 +++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/autoload/fern.vim b/autoload/fern.vim index 4e0ce4f..4c8f521 100644 --- a/autoload/fern.vim +++ b/autoload/fern.vim @@ -36,6 +36,7 @@ call s:Config.config(expand(':p'), { \ 'disable_drawer_auto_resize': 0, \ 'disable_drawer_smart_quit': get(g:, 'disable_drawer_auto_quit', 0), \ 'disable_drawer_hover_popup': 0, + \ 'disable_drawer_universal': 1, \ 'disable_drawer_auto_restore_focus': 0, \ 'default_hidden': 0, \ 'default_include': '', diff --git a/autoload/fern/internal/command/fern.vim b/autoload/fern/internal/command/fern.vim index 12f3eef..9cc8de7 100644 --- a/autoload/fern/internal/command/fern.vim +++ b/autoload/fern/internal/command/fern.vim @@ -71,6 +71,9 @@ function! fern#internal#command#fern#command(mods, fargs) abort \ ? printf('drawer-right:%d', tabpagenr()) \ : printf('drawer:%d', tabpagenr()) \ : '' + if drawer && !g:fern#disable_drawer_universal + let fri.authority = right ? 'drawer-right:0' : 'drawer:0' + endif let fri.query = extend(fri.query, { \ 'width': width, \ 'keep': keep, diff --git a/autoload/fern/internal/viewer/auto_duplication.vim b/autoload/fern/internal/viewer/auto_duplication.vim index 4674158..be58e55 100644 --- a/autoload/fern/internal/viewer/auto_duplication.vim +++ b/autoload/fern/internal/viewer/auto_duplication.vim @@ -1,5 +1,5 @@ function! fern#internal#viewer#auto_duplication#init() abort - if g:fern#disable_viewer_auto_duplication + if g:fern#disable_viewer_auto_duplication || !g:fern#disable_drawer_universal return endif diff --git a/doc/fern.txt b/doc/fern.txt index 7f98cfd..a407a74 100644 --- a/doc/fern.txt +++ b/doc/fern.txt @@ -421,6 +421,15 @@ VARIABLE *fern-variable* Default: 0 +*g:fern#disable_drawer_universal* + Set 1 to disable the universal fern trees for left and right position + respectively. + + If enabled, there is only one left or right drawer across the all the windows + for a given VIM instance. + + Default: 1 + *g:fern#disable_drawer_smart_quit* Set 1 to disable smart quit behavior when there are only two buffer remains (one is for the drawer styled fern window.) From 404789c9b41a82321f833efc202e3ff3d111ee84 Mon Sep 17 00:00:00 2001 From: Yudi Zhou Date: Sat, 19 Mar 2022 16:44:58 -0700 Subject: [PATCH 2/3] Address PR comments --- autoload/fern.vim | 2 +- autoload/fern/internal/command/fern.vim | 2 +- autoload/fern/internal/viewer/auto_duplication.vim | 2 +- doc/fern.txt | 11 +++++------ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/autoload/fern.vim b/autoload/fern.vim index 4c8f521..a734161 100644 --- a/autoload/fern.vim +++ b/autoload/fern.vim @@ -36,7 +36,7 @@ call s:Config.config(expand(':p'), { \ 'disable_drawer_auto_resize': 0, \ 'disable_drawer_smart_quit': get(g:, 'disable_drawer_auto_quit', 0), \ 'disable_drawer_hover_popup': 0, - \ 'disable_drawer_universal': 1, + \ 'disable_drawer_tabpage_isolation': 0, \ 'disable_drawer_auto_restore_focus': 0, \ 'default_hidden': 0, \ 'default_include': '', diff --git a/autoload/fern/internal/command/fern.vim b/autoload/fern/internal/command/fern.vim index 9cc8de7..de486bc 100644 --- a/autoload/fern/internal/command/fern.vim +++ b/autoload/fern/internal/command/fern.vim @@ -71,7 +71,7 @@ function! fern#internal#command#fern#command(mods, fargs) abort \ ? printf('drawer-right:%d', tabpagenr()) \ : printf('drawer:%d', tabpagenr()) \ : '' - if drawer && !g:fern#disable_drawer_universal + if drawer && g:fern#disable_drawer_tabpage_isolation let fri.authority = right ? 'drawer-right:0' : 'drawer:0' endif let fri.query = extend(fri.query, { diff --git a/autoload/fern/internal/viewer/auto_duplication.vim b/autoload/fern/internal/viewer/auto_duplication.vim index be58e55..9f4e935 100644 --- a/autoload/fern/internal/viewer/auto_duplication.vim +++ b/autoload/fern/internal/viewer/auto_duplication.vim @@ -1,5 +1,5 @@ function! fern#internal#viewer#auto_duplication#init() abort - if g:fern#disable_viewer_auto_duplication || !g:fern#disable_drawer_universal + if g:fern#disable_viewer_auto_duplication || g:fern#disable_drawer_tabpage_isolation return endif diff --git a/doc/fern.txt b/doc/fern.txt index a407a74..f598b2e 100644 --- a/doc/fern.txt +++ b/doc/fern.txt @@ -421,14 +421,13 @@ VARIABLE *fern-variable* Default: 0 -*g:fern#disable_drawer_universal* - Set 1 to disable the universal fern trees for left and right position - respectively. +*g:fern#disable_drawer_tabpage_isolation* + Set 1 to disable the drawer tabpage isolation. - If enabled, there is only one left or right drawer across the all the windows - for a given VIM instance. + If disabled, there is only one left or right drawer across the all the + windows and tabs for a given VIM instance. - Default: 1 + Default: 0 *g:fern#disable_drawer_smart_quit* Set 1 to disable smart quit behavior when there are only two buffer From cc86a0984e93f0515cbf66c6622157b0834ac7df Mon Sep 17 00:00:00 2001 From: Yudi Zhou Date: Sat, 19 Mar 2022 21:47:38 -0700 Subject: [PATCH 3/3] Address PR comments --- autoload/fern/internal/viewer/auto_duplication.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/fern/internal/viewer/auto_duplication.vim b/autoload/fern/internal/viewer/auto_duplication.vim index 9f4e935..0522ce5 100644 --- a/autoload/fern/internal/viewer/auto_duplication.vim +++ b/autoload/fern/internal/viewer/auto_duplication.vim @@ -1,5 +1,6 @@ function! fern#internal#viewer#auto_duplication#init() abort - if g:fern#disable_viewer_auto_duplication || g:fern#disable_drawer_tabpage_isolation + if g:fern#disable_viewer_auto_duplication || + \ (g:fern#disable_drawer_tabpage_isolation && fern#internal#drawer#is_drawer()) return endif