From 6416ea356250daecc2026c45eb576a558612cd43 Mon Sep 17 00:00:00 2001 From: kiyan Date: Sat, 2 Oct 2021 14:04:01 +0200 Subject: [PATCH] chore: add old option detection in plugin/nvim-tree.lua --- lua/nvim-tree.lua | 32 -------------------------------- plugin/nvim-tree-startup.lua | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 32 deletions(-) create mode 100644 plugin/nvim-tree-startup.lua diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 94779f2e..c0f32899 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -450,36 +450,4 @@ function M.setup(conf) vim.schedule(function() M.on_enter(opts) end) end -local function startup_check_new_setup() - local out_config = { - "nvim_tree_disable_netrw", - "nvim_tree_hijack_netrw", - "nvim_tree_auto_open", - "nvim_tree_auto_close", - "nvim_tree_tab_open", - "nvim_tree_update_cwd", - "nvim_tree_hijack_cursor", - "nvim_tree_system_open_command", - "nvim_tree_system_open_command_args", - "nvim_tree_follow", - "nvim_tree_follow_update_path", - "nvim_tree_lsp_diagnostics", - "nvim_tree_auto_resize", - "nvim_tree_bindings", - "nvim_tree_disable_keybindings", - "nvim_tree_disable_default_keybindings", - } - - local x = vim.tbl_filter(function(v) - return vim.fn.exists('g:'..v) ~= 0 - end, out_config) - - if #x > 0 then - local msg = "following options are now set in the setup, please read the new documentation for the setup function: " - require'nvim-tree.utils'.echo_warning(msg..table.concat(x, " | ")) - end -end - -vim.defer_fn(startup_check_new_setup, 1000) - return M diff --git a/plugin/nvim-tree-startup.lua b/plugin/nvim-tree-startup.lua new file mode 100644 index 00000000..ec7da097 --- /dev/null +++ b/plugin/nvim-tree-startup.lua @@ -0,0 +1,34 @@ +local is_initialized = false + +if is_initialized then + return +end +is_initialized = true + +local out_config = { + "nvim_tree_disable_netrw", + "nvim_tree_hijack_netrw", + "nvim_tree_auto_open", + "nvim_tree_auto_close", + "nvim_tree_tab_open", + "nvim_tree_update_cwd", + "nvim_tree_hijack_cursor", + "nvim_tree_system_open_command", + "nvim_tree_system_open_command_args", + "nvim_tree_follow", + "nvim_tree_follow_update_path", + "nvim_tree_lsp_diagnostics", + "nvim_tree_auto_resize", + "nvim_tree_bindings", + "nvim_tree_disable_keybindings", + "nvim_tree_disable_default_keybindings", +} + +local x = vim.tbl_filter(function(v) + return vim.fn.exists('g:'..v) ~= 0 +end, out_config) + +if #x > 0 then + local msg = "following options are now set in the setup (:help nvim-tree.setup): " + require'nvim-tree.utils'.echo_warning(msg..table.concat(x, " | ")) +end