Skip to content
Open
Changes from 3 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
13 changes: 12 additions & 1 deletion lua/nvim-tree/actions/fs/clipboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,18 @@ function Clipboard:do_paste(node, action, action_fn)

-- Paste non-conflicting items immediately
for _, item in ipairs(no_conflict) do
do_paste_one(item.node.absolute_path, item.dest, action, action_fn)
local absolute_path = item.node.absolute_path
if absolute_path:sub(1, #"http") == "http" then
notify.info("Downloading " .. absolute_path .. " to " .. item.dest .. "...")
local result = vim.fn.system({ "curl", "-sL", absolute_path, "-o", item.dest })

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as it pains me to talk about netrw, it appears that it handle almost all protocols:

e.g.

nvim --clean
:Nread https://raw.githubusercontent.com/nvim-tree/nvim-tree.lua/refs/heads/master/README.md

Perhaps we could invoke it to do all the work.

if vim.v.shell_error == 0 then
notify.info("Downloaded " .. absolute_path .. " successfully at " .. item.dest)
else
notify.error("Error downloading " .. absolute_path .. ": " .. result)
end
else
do_paste_one(absolute_path, item.dest, action, action_fn)
end
end

-- Resolve conflicts in batch
Expand Down
Loading