Skip to content

Commit 7ec12c7

Browse files
committed
fix: auto resize when opening/closing windows
1 parent efd96f4 commit 7ec12c7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lua/nvim-tree.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ local function setup_autocommands(opts)
263263
vim.cmd "au BufEnter,BufNewFile * lua require'nvim-tree'.open_on_directory()"
264264
end
265265

266+
vim.cmd "au WinClosed,WinNew * lua vim.schedule(function() require'nvim-tree'.resize() end)"
267+
266268
vim.cmd "augroup end"
267269
end
268270

lua/nvim-tree/view.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function M.resize(size)
169169
M.View.height = size
170170
end
171171

172-
if not a.nvim_win_is_valid(M.get_winnr()) then
172+
if not M.is_visible() then
173173
return
174174
end
175175

0 commit comments

Comments
 (0)