File tree 3 files changed +12
-3
lines changed
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -236,6 +236,17 @@ local function setup_autocommands(opts)
236
236
end ,
237
237
})
238
238
end
239
+
240
+ -- Handles event dispatch when tree is closed by `:q`
241
+ create_nvim_tree_autocmd (" WinClosed" , {
242
+ pattern = " *" ,
243
+ --- @param ev vim.api.keyset.create_autocmd.callback_args
244
+ callback = function (ev )
245
+ if vim .api .nvim_get_option_value (" filetype" , { buf = ev .buf }) == " NvimTree" then
246
+ require (" nvim-tree.events" )._dispatch_on_tree_close ()
247
+ end
248
+ end ,
249
+ })
239
250
end
240
251
241
252
local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
Original file line number Diff line number Diff line change 1
1
local view = require (" nvim-tree.view" )
2
2
local core = require (" nvim-tree.core" )
3
- local events = require (" nvim-tree.events" )
4
3
local notify = require (" nvim-tree.notify" )
5
4
6
5
--- @class LibOpenOpts
@@ -130,7 +129,6 @@ function M.open(opts)
130
129
open_view_and_draw ()
131
130
end
132
131
view .restore_tab_state ()
133
- events ._dispatch_on_tree_open ()
134
132
end
135
133
136
134
function M .setup (opts )
Original file line number Diff line number Diff line change @@ -254,7 +254,6 @@ local function close(tabpage)
254
254
return
255
255
end
256
256
end
257
- events ._dispatch_on_tree_close ()
258
257
return
259
258
end
260
259
end
@@ -425,6 +424,7 @@ function M.open_in_win(opts)
425
424
M .reposition_window ()
426
425
M .resize ()
427
426
end
427
+ events ._dispatch_on_tree_open ()
428
428
end
429
429
430
430
function M .abandon_current_window ()
You can’t perform that action at this time.
0 commit comments