Skip to content

fix(#2395): marks.bulk.move defaults to directory at cursor #2688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lua/nvim-tree/marks/bulk-move.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local core = require "nvim-tree.core"
local utils = require "nvim-tree.utils"
local rename_file = require "nvim-tree.actions.fs.rename-file"
local notify = require "nvim-tree.notify"
local lib = require "nvim-tree.lib"

local M = {
config = {},
Expand All @@ -14,9 +15,18 @@ function M.bulk_move()
return
end

local node_at_cursor = lib.get_node_at_cursor()
local default_path = core.get_cwd()

if node_at_cursor and node_at_cursor.type == "directory" then
default_path = node_at_cursor.absolute_path
elseif node_at_cursor and node_at_cursor.parent then
default_path = node_at_cursor.parent.absolute_path
end

local input_opts = {
prompt = "Move to: ",
default = core.get_cwd(),
default = default_path,
completion = "dir",
}

Expand Down