feat: add feature to download from url when p from register#3339
feat: add feature to download from url when p from register#3339Uanela wants to merge 5 commits into
p from register#3339Conversation
gegoune
left a comment
There was a problem hiding this comment.
I wasn't following recent discussions too closely, got one question: why do we want nvim-tree to handle fetching files over http?
Co-authored-by: gegoune <69750637+gegoune@users.noreply.github.com>
I read this through my phones notification bar and it sounded like This PR as more to do with #3336 and is basically a one tiny addition to allow download files, WHY? On #3336 I added a feature to allow 1 - Copy/Cut files from anywhere on the OS as far as you got the absolute path, I can go to finder/explorer simply grab the absolute path and go paste into nvim-tree |
Fix is_nodes_array function to correctly identify node arrays.
|
Hope you don't mind, I changed the target branch for reviewability. It will change to master after merge. |
| 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 }) |
There was a problem hiding this comment.
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.
|
There is also https://github.com/miversen33/netman.nvim which we could integrate with to provide the file transfers. |
Depends on #3336
Summary
This PR simply takes #3336 one step further and allows downloading files directly to nvim when it finds URL on the register on
p.Context: #3336 (comment)