From 494c9ecfbfe4e812d0c81b1f9169f336ffc35f75 Mon Sep 17 00:00:00 2001 From: kiyan Date: Tue, 22 Feb 2022 00:10:55 +0100 Subject: [PATCH] fix(auto_close): do not close tree if buffers are modified fixes #891 --- lua/nvim-tree.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 09e6c4d9..34c0a2c4 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -130,8 +130,10 @@ M.resize = view.resize local function should_abort_auto_close() local buf = api.nvim_get_current_buf() local buftype = api.nvim_buf_get_option(buf, 'ft') - local modified = api.nvim_buf_get_option(buf, 'modified') - return modified or buftype:match('Telescope') ~= nil + local modified = vim.tbl_filter(function(b) + return api.nvim_buf_get_option(b, 'modified') + end, api.nvim_list_bufs()) + return #modified > 0 or buftype:match('Telescope') ~= nil end function M.auto_close()