diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index f7eb96f6163..be32bce8885 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -171,7 +171,6 @@ Subsequent calls to setup will replace the previous configuration. > require("nvim-tree").setup { -- BEGIN_DEFAULT_OPTS auto_reload_on_write = true, - create_in_closed_folder = false, disable_netrw = false, hijack_cursor = false, hijack_netrw = true, @@ -434,11 +433,6 @@ in some scenarios (eg using vim startify). Reloads the explorer every time a buffer is written to. Type: `boolean`, Default: `true` -*nvim-tree.create_in_closed_folder* -Creating a file when the cursor is on a closed folder will set the -path to be inside the closed folder, otherwise the parent folder. - Type: `boolean`, Default: `false` - *nvim-tree.sort_by* Changes how files within the same directory are sorted. Can be one of `name`, `case_sensitive`, `modification_time`, `extension` or a diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 4992de68a53..efb0fb172e4 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -447,7 +447,6 @@ end local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS auto_reload_on_write = true, - create_in_closed_folder = false, disable_netrw = false, hijack_cursor = false, hijack_netrw = true, diff --git a/lua/nvim-tree/actions/fs/copy-paste.lua b/lua/nvim-tree/actions/fs/copy-paste.lua index c5cd5e2acd3..05ef581d9f4 100644 --- a/lua/nvim-tree/actions/fs/copy-paste.lua +++ b/lua/nvim-tree/actions/fs/copy-paste.lua @@ -160,11 +160,8 @@ local function do_paste(node, action_type, action_fn) return end local is_dir = stats and stats.type == "directory" - if not is_dir then destination = vim.fn.fnamemodify(destination, ":p:h") - elseif not node.open then - destination = vim.fn.fnamemodify(destination, ":p:h:h") end for _, _node in ipairs(clip) do diff --git a/lua/nvim-tree/actions/fs/create-file.lua b/lua/nvim-tree/actions/fs/create-file.lua index 35ec267d77d..c970eeddab5 100644 --- a/lua/nvim-tree/actions/fs/create-file.lua +++ b/lua/nvim-tree/actions/fs/create-file.lua @@ -42,8 +42,7 @@ local function get_num_nodes(iter) end local function get_containing_folder(node) - local is_open = M.create_in_closed_folder or node.open - if node.nodes ~= nil and is_open then + if node.nodes ~= nil then return utils.path_add_trailing(node.absolute_path) end local node_name_size = #(node.name or "") @@ -113,7 +112,6 @@ function M.fn(node) end function M.setup(opts) - M.create_in_closed_folder = opts.create_in_closed_folder M.enable_reload = not opts.filesystem_watchers.enable end diff --git a/lua/nvim-tree/legacy.lua b/lua/nvim-tree/legacy.lua index caead4d5996..50aef3231a3 100644 --- a/lua/nvim-tree/legacy.lua +++ b/lua/nvim-tree/legacy.lua @@ -268,12 +268,6 @@ local g_migrations = { o.respect_buf_cwd = vim.g.nvim_tree_respect_buf_cwd == 1 end end, - - nvim_tree_create_in_closed_folder = function(o) - if o.create_in_closed_folder == nil then - o.create_in_closed_folder = vim.g.nvim_tree_create_in_closed_folder == 1 - end - end, } local function refactored(opts) @@ -309,6 +303,11 @@ local function removed(opts) notify.warn "focus_empty_on_setup has been removed and will be replaced by a new startup configuration. Please remove this option. See https://bit.ly/3yJch2T" opts.focus_empty_on_setup = nil end + + if opts.create_in_closed_folder then + notify.warn "create_in_closed_folder has been removed and is now the default behaviour. You may use api.fs.create to add a file under your desired node." + end + opts.create_in_closed_folder = nil end function M.migrate_legacy_options(opts)