Skip to content

Commit db547dc

Browse files
committed
fix: defer the options check
the new setup refactoring might have some issues when users require the tree before setting up global options, which might result in a startup check not detecting those out of date options.
1 parent 2a5d529 commit db547dc

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

lua/nvim-tree.lua

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -438,28 +438,32 @@ function M.setup(conf)
438438
vim.schedule(function() M.on_enter(opts) end)
439439
end
440440

441-
local out_config = {
442-
"nvim_tree_disable_netrw",
443-
"nvim_tree_hijack_netrw",
444-
"nvim_tree_auto_open",
445-
"nvim_tree_auto_close",
446-
"nvim_tree_tab_open",
447-
"nvim_tree_update_cwd",
448-
"nvim_tree_hijack_cursor",
449-
"nvim_tree_system_open_command",
450-
"nvim_tree_system_open_command_args",
451-
"nvim_tree_follow",
452-
"nvim_tree_follow_update_path",
453-
"nvim_tree_lsp_diagnostics"
454-
}
455-
456-
local x = vim.tbl_filter(function(v)
457-
return vim.fn.exists('g:'..v) ~= 0
458-
end, out_config)
459-
460-
if #x > 0 then
461-
local msg = "following options are now set in the setup, please read the new documentation for the setup function: "
462-
require'nvim-tree.utils'.echo_warning(msg..table.concat(x, " | "))
441+
local function startup_check_new_setup()
442+
local out_config = {
443+
"nvim_tree_disable_netrw",
444+
"nvim_tree_hijack_netrw",
445+
"nvim_tree_auto_open",
446+
"nvim_tree_auto_close",
447+
"nvim_tree_tab_open",
448+
"nvim_tree_update_cwd",
449+
"nvim_tree_hijack_cursor",
450+
"nvim_tree_system_open_command",
451+
"nvim_tree_system_open_command_args",
452+
"nvim_tree_follow",
453+
"nvim_tree_follow_update_path",
454+
"nvim_tree_lsp_diagnostics"
455+
}
456+
457+
local x = vim.tbl_filter(function(v)
458+
return vim.fn.exists('g:'..v) ~= 0
459+
end, out_config)
460+
461+
if #x > 0 then
462+
local msg = "following options are now set in the setup, please read the new documentation for the setup function: "
463+
require'nvim-tree.utils'.echo_warning(msg..table.concat(x, " | "))
464+
end
463465
end
464466

467+
vim.defer_fn(startup_check_new_setup, 1000)
468+
465469
return M

0 commit comments

Comments
 (0)