File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,41 @@ function M.global()
1717 end ,
1818 })
1919
20+ vim .api .nvim_create_autocmd (" SessionLoadPost" , {
21+ group = augroup_id ,
22+ callback = function ()
23+ local api = require (" nvim-tree.api" ).tree
24+
25+ --- @type table<integer,boolean>
26+ local tabs = {}
27+
28+ for _ , tab in ipairs (vim .api .nvim_list_tabpages ()) do
29+ for _ , win in ipairs (vim .api .nvim_tabpage_list_wins (tab )) do
30+ local buf = vim .api .nvim_win_get_buf (win )
31+ if api .is_tree_buf (buf ) then
32+ tabs [tab ] = true
33+ end
34+ end
35+ end
36+
37+ vim .schedule (function ()
38+ api .close_in_all_tabs ()
39+
40+ for tab , _ in pairs (tabs ) do
41+ if vim .api .nvim_tabpage_is_valid (tab ) then
42+ local win = vim .api .nvim_tabpage_get_win (tab )
43+
44+ if vim .api .nvim_win_is_valid (win ) then
45+ vim .api .nvim_win_call (win , function ()
46+ api .open ()
47+ end )
48+ end
49+ end
50+ end
51+ end )
52+ end ,
53+ })
54+
2055 if config .g .tab .sync .open then
2156 vim .api .nvim_create_autocmd (" TabEnter" , {
2257 group = augroup_id ,
You can’t perform that action at this time.
0 commit comments