-
-
Notifications
You must be signed in to change notification settings - Fork 623
Sync closing of nvim-tree across tabs #1698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
43ee246
56b6262
86e98ef
e81742f
4a598d3
c8a98fe
5e1d7ff
32b942b
3d11c92
a23b11d
de12e39
c46c921
dc79eaf
485b0ec
224854c
e360a32
ded6a85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
local api = vim.api | ||
|
||
local view = require "nvim-tree.view" | ||
local lib = require "nvim-tree.lib" | ||
|
||
local M = {} | ||
|
||
local Actions = { | ||
close = view.close, | ||
close = api.close, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like you're referencing the vim api instead of nvim-tree |
||
|
||
-- Tree modifiers | ||
collapse_all = require("nvim-tree.actions.tree-modifiers.collapse-all").fn, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,7 +186,7 @@ local function save_tab_state() | |
M.View.cursors[tabpage] = a.nvim_win_get_cursor(M.get_winnr()) | ||
end | ||
|
||
function M.close() | ||
function M.close(all_tabpages) | ||
if not M.is_visible() then | ||
return | ||
end | ||
|
@@ -200,8 +200,13 @@ function M.close() | |
if tree_win == current_win and prev_win > 0 then | ||
a.nvim_set_current_win(vim.fn.win_getid(prev_win)) | ||
end | ||
if a.nvim_win_is_valid(tree_win) then | ||
a.nvim_win_close(tree_win, true) | ||
a.nvim_win_close(tree_win, true) | ||
if all_tabpages then | ||
for _, v in pairs(M.View.tabpages) do | ||
if v.winnr and a.nvim_win_is_valid(v.winnr) then | ||
a.nvim_win_close(v.winnr, true) | ||
end | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is failing when the tree is not open in the current tab: tab = {
sync = {
open = false,
close = false,
ignore = {},
},
}, Fail:
Pass:
It looks like we will need to move the all-tabs-closing bit out of the nvim_list_wins loop. |
||
events._dispatch_on_tree_close() | ||
return | ||
|
Uh oh!
There was an error while loading. Please reload this page.